Tag: flash

AS3: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::SimpleButton

If you get an error like this in an actionscript 3 Flash file: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::SimpleButton@61422481 to [symbolname]. at flash.display::Sprite/constructChildren() at flash.display::Sprite() at flash.display::MovieClip() at classname()[/path_to/as/classname.as:34] Check the symbol

Continue reading

An Actionscript 3 Drag and Drop Medical Treasure Hunt Game

This game is a framework to create a simulation of a crash cart in a hospital. A crash cart is a red metal tool cart with 6 drawers, filled with the items used by the Cardiac Arrest team to save people’s lives when they have a cardiac arrest. Speed is of the essence in an arrest, so the people on the team need to know exactly where each item is in the drawers. The goal of this game is to help train team members to find the items they need.

An item to be found is randomly chosen, and the player clicks on a drawer and looks through the items to find the one they are looking for. When it is found, they drag the item to the target (which will probably be animated and a whole lot cooler looking in the final game. If they get it right, they get positive feedback of some sort and another item is chosen. If not, the item pops back to its last position before the drag and they get another chance to find the correct item.

Continue reading

Error #1056: Cannot create property x on loaded clip in AS3

I had a particularly sticky flash problem where a MovieClip worked perfectly when run on its own, but when loaded into a container clip using a loader, would give:

Error #1056: Cannot create property someProperty on loaded clip myLoadedClip
At first I thought it was some kind of timing problem or failure to declare the items in the clip, but it turned out, simply adding the word dynamic to the class definition fixed the problem. Dynamic classes can have properties added at runtime. The MovieClip class is already dynamic, but apparently, the dynamic property is removed in some other part of my code.

Continue reading

useButtonMode = true not working in AS3

In Actionscript 3, you may find yourself wondering why when you use “useHandCursor” on a MovieClip, the cursor remains an arrow on mouse_down.

In AS3, useHandCursor is a property of the SimpleButton class. if an object has “buttonMode” set to true, by default “useHandCursor” will also be true. If is is not set to buttonMode, setting “useHandCursor” to true will do nothing.

On objects that are set to buttonMode, setting “useHandCursor to false will prevent the cursor from changing to a hand on MOUSE_DOWN.

Continue reading