A little addition to a previous post on adding symbols dynamically from the library. I was having difficulty adding classes(that weren't in the library) dynamically - they weren't being recognised. var classRef:Class = getDefinitionByName("Square") as Class;
var shape:IShape= new classRef() as IShape;
//Flash displays: ReferenceError: Error #1065: Variable Square is not defined.With help from Aaron Beall(on adobe forums) who was having the same problem, i've realised that obviously flash doesn't know to compile the class if it only exists in a string. So we need to ensure that flash compiles every possible class that we may refer to dynamically. We can do this simply by declaring a variable of that class type.var squareRef:Square;
I've been wondering why items in my library disappear occasionally - including the library buttons and column headers!I've narrowed the problem down to a CS4 bug. Steps to reproduce bug: 1.Create a MovieClip 2. Select 'Component Definition' 3. Add a parameter so that the component icon will become visible. 4. Select 'Seek Bar Control Icon' or 'Buffering Control Icon' as custom component icon. 5. Select 'OK' 6. Watch the craziness ensue!
It has always bothered me that animations of raster images are always jerky when they get to the point of animating less than a pixel per frame. Flash assumes that rasters should only live on the exact pixel. This can be resolved with bitmaps that are created with ActionScript with the Bitmap.pixelSnapping value but for pure animation is a little more complicated.I've just discovered that if you adjust the scale, rotation or skew of the image, Flash will turn pixelSnapping off. So giving a slight degree(more than 0.1%) of one of these factors is the simplest way to demand no pixelSnapping, without requiring one line of ActionScript.
I was trying to work out why the Flash Player Settings window was not appearing when i attached a webcam to a Video object, when i discovered that my stage was too small. Although i can't find documentation for this feature anywhere, I have found through experimentation that for the Settings Window to appear, the stage must be a minimum of 214x137.
noted a strange incompatibility today - the stage.mouseLeave event doesn't get triggered when you hold a mouse button down, and drag off stage on a flash object which has wmode set to transparent. in fact doing so takes the focus off the flash object so that regular stage events no longer get triggered until it receives focus again(say by the user clicking on the object).sounds obscure, but if someone's dragging a slider and somehow drags off the object, releases the mouse button and then returns to the object, the slider continues to move around with the mouse even though the mouseButton isn't down.
just got back from a six week holiday, so was wondering if i'd lost my mind while i was away...steps to recreate weird problem:1. set up two dynamic text boxes on the stage - one bold and one not bold - both with letter spacing of 1.(hint at solution) give them instance names - text1 and text22. set their text attributes in actionscript eg.text1.text="hello";
text2.text="there";3. run out - notice that neither text box is bold.for some bizarre reason, giving the text box a letter spacing value!=0 means that it loses its formatting when you set its text value.to resolve either set letter spacing to 0, or follow my earlier post in setting text with a letter spacing value.
What a laborious problem this was!
I had set up a DataGrid that resized with the browser, and the user could also resize the column widths. However one column contained a button, and needed to not be resizable by the user or by browser resizing. But in practice, the button was resizing smaller and smaller every time the browser was resized. After many forum postings a solution was suggested(thanks VarioPegged) that is not the most elegant but works:
To recap, three steps must be followed:
1. add a dummy datagridcolumn to the far right of the datagrid that is not resizable and has a width of 0.
2. give the column you don't want to resize a minWidth value.
3. set up an updateComplete event handler on the datagrid, which resizes the button column and then calls validateNow() on the datagrid.
you can follow the newsgroup post on this issue here.