The Big Drum
The Big Drum (formally known as Jam-O-Drum) is a multi-user percussion instrument completed for the EMP Museum in 2010.
Video Copyright: Reek Havok
ASDocs Can’t find class reference
Check that you are using all the classes you import. If you import a class but never reference the class in your code, ASDocs will through an error that the class can’t be found.
AS3: Error: 1104: Invalid XML Name (in a for loop?)
A result of a long day staring at the screen, my for loop was written like this:
for(var int:i = 0; i=< n; i++)
Do you see the issue? I didn’t, but my more awake and eagle eyed co-worker did. The less than or equals sign was flipped so instead of <= I wrote =<.
The =< was :(.
AS3: stop() ignored in MovieClip
I had a MovieClip named Star
with a stop()
action on a frame about midway through the clip’s timeline. The class name set in the Flash IDE pointed directly to my AS file.
In another AS file, I constructed a Star
using new Star()
and added the Star
instance to the stage.
The clip added to the stage fine, but the stop()
action was ignored!!
The problem was twofold:
1) The Star
clip was in a different FLA then where the code to create a new Star
was. If the Star
library item was in the same FLA, there would be no problem.
2) Sine the library item and the constructing code was separate, the construction of the new Star
grabbed all the timeline art fine, used only the AS file for code!! The fix was to use a generic name for the classname of the library item StarClip
which used the Star
AS file as the base class. The constructor code then used StarClip
– and all was well.
Here is the new constructor code:
var StarClass:Class = ApplicationDomain.currentDomain.getDefinition("StarClip") as Class;
var star:MovieCLip = new StarClass() as MovieClip;
AS3: Turning off the yellow rectangles when tabbing
If you don’t want yellow rectangles AND you don’t need tabbing put this code in your document class:
this.tabEnabled = false;
this.tabChildren = false;
If you need tabbing but do not want the yellow rectangles use this on the offending DisplayObjects:
displayObj.focusRect = false;
Git: src refspec not found
I am new to Git as of the date of this post, and I am still figuring this out. I had made a new repository for a new Git project and somewhere in there I messed up something with my first repository. I could commit, but I could not push. In the end I had to re-checkout the master branch and then I could push to the server.
AS3: CS6 – Argument Error #2109: Label null not found in scene null
In CS6 if you have a library item that shares a class name with a library item in another FLA, you will get this error or something like it where null is replaced with another word. Removing the conflict may fix the issue.
Another reason for this error is calling gotoAndPlay
or gotoAndStop
and using a non-existent label.
AS3: TypeError: Error #2007: Parameter type must be non-null. ErrorEvent/ctor()
Chances are that you have multiple SWFs in your project and you’ve added static types to an event class, but have not republished all your SWFs. The problem is that a SWF that is loaded prior to the one you’ve just published has a different event class definition that does not include the new types. Just republish your other SWFs, or just the first one loaded that’s sharing the definition if you are using one application domain, and you should be good. If not – leave a comment with the issue, or other reason you got this error.
AS3: SWF Flickers First Frame or Loops Timeline Ignoring stop()
If you trace(this.totalframes) on the first frame of your main timeline, you may get a shock – the totalFrames number is greater than the frames in your timeline. If that happens to you, check how many scenes you have (Window->Other Panels->Scenes). Chances are you have magically acquired empty scenes called Scene1, and your SWF is looping through them. Delete the extra scenes all all should be well again!