actionscript-3

Using constants in object declaration?

I want to create a function pointer object: private var func:Object = { Class.Constant: function }; What is the clean way of doing this? I did the above and got Error: Syntax error: expecting colon before dot. And I'm not even sure that's right. The goal is that I can just do func[ Constants ](); somewhere later. ...

How do I make a MenuBar with 2 menus left justified and one menu right justified.

I want a MenuBar that has, for instance, a File and Edit menu on the left, and a Help menu on the right. Is there any convenient way to accomplish this? ...

How do I protect my Flash/Flex SWF with code?

I've written some fancy Flex app, which doesn't really require any server side integration. Now if someone took that SWF and put it in their server then it will very well run. What code can recognize that the SWF is not under my domain and stop from execution during startup? I don't mind making some server side calls just to do a che...

(ActionScript) Move objects in an array producing a stadium wave effect...

I want to move all objects in an array producing a stadium wave effect, how do i do that? I want to move the objects based on their y-value on the stage... all my squares are of 50x50 in size. I want to move them up then move them down. Below is my code, please give me advice. Thanks! import fl.transitions.Tween; import fl.transitions....

What is the correct way to add components to the library of a Swf?

I've been having a problem that's plagued me many times in the course of developing a Flash project. It looks something like this: TypeError: Error #1009: Cannot access a property or method of a null object reference. at fl.containers::BaseScrollPane/fl.containers:BaseScrollPane::drawBackground() at fl.controls::TileList/fl.controls:Til...

does the display index effect the scope of an object ??

Just curious to know if the index effect the scope of an object because I am creating a game and for some reason, I get an error like below TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.objects::Torret/updateObject() at com.objects::EngineApi/loop() depending on where I put my o...

Syntax Guide for ActionScript 3.0

Is there a practical "crash" guide for writing ActionScript 3. There's migration books from as2 to as3, but I'm not migrating. People that have programmed in C seem to understand the math concepts and arguments. Books, links, a better debugging panel would all be helpful. Here's my ideas, any suggestions. SIMPLE EXAMPLES "." is the ...

Counter in AS3 "without dynamic text field"

What is the best way to program an LED number tick. I need to have a number display that goes up to 1,000,000.00. Dynamic text fields are not an option because of symbol instances. How would I make a counter? ANIMATION The numbers move in increments like an LED display. This NUMBERS The numbers multiple by ten each space over decima...

create private var yada:Whatever; depending on xml count

I am trying to declare private variables that will be used elsewhere in my flex mxml main application. But I need to only create the variables when their is an equal number in my xml file. My xml snippet looks like this: <POIs> <location> <name>jane</name> <lat>12345</lat> <long>12345</long> ...

How to add images into Adobe Flex Builder RichTextEditor?

How to add images into Adobe Flex Builder RichTextEditor control? I mean using a button =) So we have some text edior with RTE a-la We want to get into its content images using some button. How to do such thing? BTW: I found this http://anotherflava.com/2009/01/12/flex-xhtml-rich-text-editor-w-images/ but I realy do not understand h...

Open Source Flex mxml actionscript Table creator and editor?

I'm searching for at least simple Open Source Flex mxml actionscript Table creator and editor? I need it to be able to create simple tables and generate some text (xml or HTML ) representation of thair contents ...

How to rotate BitmapData when using draw method. Width height bounds clipping / cropping problem.

I wrote a collision detection class that works off using BitmapData.hitTest. Basically, every update, the .draw method is called and then two BitmapData's are hitTest'ed against each other to see if there is a collision. It works pretty well, however if I start rotating the source MovieClip I use for the BitmapData, the transformations ...

AS3: Why does datatype automatically change from TextField to DisplayObject on its own?

What's happening in this simple piece of AS3 code? Why does my object change from TextField to the more generic DisplayObject? public class Menu extends MovieClip { private var active_button:SimpleButton; public function Menu() { active_button = SimpleButton( menu_list.getChildAt( 0 )); // ignore menu_lis...

How to add Column to Adobe flex mx:DataGrid in mxml and/or actionsctpt?

I have simple mxml code <mx:DataGrid id="DGG" editable="true"> <mx:dataProvider> <mx:Object scheduledDate="4/1/2006"/> </mx:dataProvider> </mx:DataGrid> <mx:Button id="SetBut" label="Set Array as Data Provider" click="SetDP(); AddBut.visible = true;" x="100.5" y="1...

What is $height in Flex 3.x?

When debugging some container sizes (namely, HBox) in Flex (v. 3.5), I noticed a variable "$height" in the Variables list. Does anyone know what this variable is? It's marked as protected, but I don't believe I can access it in a child class. I've noticed it sometimes gets a different value than "height" and "_height". Does anyone kn...

AS3 ERROR : Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.

Hi I am new to as3 and have a problem with a site im developing. It all runs fine on my local file but after I upload to a server and run I get the error Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed. Can anybode give me an idea of what I am doing wrong please ? I know that the problem is with 6 images tha...

Passing getter function, or tricky pointer in AS3

So I know as3 doesn't have pointers, but I thought there might be a way to use object variables as pointers. Right now I'm relying on passing a function that gets the get function, it's not a very elegant solution something like this: myvar = function():int{return objectName.getVarValue}; The other option would be to change all the g...

Type conversion failed when adding a object to an array.

I recieve the following error.. Type Coercion failed: cannot convert Stinger@d8d43a1 to Array. In a summary. This is what I am trying to do... var laser = new StingerLaser(); laser.laserDir = dir1; laser.wielder.push(this); laser.x = x + 20; laser.y = y + 40; eApi.addGameChild(laser); where laser.wielder is an...

saving dynamic drawing, then re-loading

ok, i've spent a good bit trying to figure out the best way to approach this ... and i'm kind of at a loss. google has NOT been much help. the short version of what i need to do - via AS3 and PHP - is a user can come to this project and draw something. drawing's no problem, that's done. my issue is figuring out how to take that drawing ...

Writing objects to socket in AS3/actionscript?

I am trying to pass object to the server through socket connection in actionscript 3. What is the best way to do that? is serialization better? or should I encode it first and then sent it as string? please help me to understand this? thank you ...