actionscript-3

Flex 4 syntax in actionscript ... ?

Hi! One (dumb) question: Is it possible to use flex 4 syntax declaration inside of a actionscript method? For example, something like that: private function buildContent() : void { <s:Label id="aLabel"> } Thanks. P.S. I couldn't find any reference about this, so i think it is not possible :). ...

Runtime fonts in Flash Builder 4

Hi, I am trying to get the following example to work in Flash Builder 4: http://developer.yahoo.com/flash/articles/runtime-fonts-as3.html The Actionscript project compiles but all I get on screen is a tiny rotated square with no text in it. Does anyone know why this might be happening? My code is identical to the example above - I ha...

Can I use C/C++ code inside my ActionScript-3 code?

I wonder if there is ways for communicate actionscript with c/c++, as well as the level of complexity.. ...

ActionScript MXML <mx:> vs <s:>

Looks like I can use components for both or . So, which has more advantages? ...

AS3: Can ByteArray return its content as a string with two bytes per unicode character?

var bytes:ByteArray = new ByteArray; bytes.writeInt(0); trace(bytes.length); // prints 4 trace(bytes.toString().length); // prints 4 When I run the above code the output suggests that every character in the string returned by toString contains one byte from the ByteArray. This is of course great if you want to display the content of t...

AS3 : Center an animation loaded in one other

Hi, I have a question to center an animation within its container. This is the container or loader: public function Main():void { trace("Constructor..."); this.addEventListener(Event.ADDED_TO_STAGE, this.addEvent); } public function addEvent(e:Event):void { trace("AddedToStage"); ...

Flex trace() doesn't print

There's a lot of examples for ActionScript over the web using trace() to print results. I'd tryied it using Flash Builder 4, but it don't print to the console. Where can I see the output? ...

Why this rectangle is not drawn?

public class Greeter extends MovieClip { public function Greeter() { addEventListener(Event.ADDED_TO_STAGE, go); } private function go(evt:Event):void { removeEventListener(Event.ADDED_TO_STAGE, go); var _root:MovieClip = parent.parent as MovieClip; var sp:Sprite = new Sprite(); ...

How to override the transform.matrix setter

I have a class which extends the Sprite object in as3. I need to be able to override the transform.matrix setter in this class but haven't been successful in doing so. I've tried many things, along with creating my own separate class which extends the Transform class and then overrides its set matrix function, and set my transform = new...

AS3 - Embedded SWF video shows totalFrames == 0

I've got this 1 minute long movie that I want to compile into an AS3 project. The movie started out in MOV format, so I used FFMpeg to convert it to FLV, then again with FFMpeg from FLV to SWF. I'm embedding this movie into the AS3 binary by using Embed metadata: [Embed(source="1.swf")] private var _Vid:Class; I've got a container ...

flex 3 programmatically enlarging a flex buttons hitArea

Hello stackOverFlower, Does anybody know how to programmatically enlarge a flex 3 button's hitArea. Is there some function that i can override? There is no function in the button class called hitArea. WHat i have done is, i have created a programmaticskin for a button. The form of the skin consists out four arrows. In between the arrow...

AS3 cross-scripting between 2 SWFs problem

Hi: I have a movie with a document class (Main.as) wich load 2 SWF: private var mainContainer:Sprite = new Sprite(); addChild(mainContainer); var loaderx:Loader = new Loader(); loaderx.contentLoaderInfo.addEventListener(Event.COMPLETE,loadingComplete); loaderx.load(new URLRequest("PhotoLoader.swf")); // PhotoLoader.as var viewer:Lo...

How to centre an image horizontaly and vertically in an Image Control?

Hi, How can I center a loaded photo [lets say 200x300] in an image control [lets say 400x600]? My image control has fixed dimensions while my contents have different dimensions and I want them to get centered automatically. Thanks in advance ...

Trying to learn actionscript/flex, trying to draw a box without mxml

Ok I'm trying to draw a box with actionscript 3 and flex 3.5. First a few things: 1) I am not using any IDE at all, just notepad and flex 2) I am not using any mxml file at all (yes this is possible with as3 apparently) 3) I am not using inheritance ie I'm not using an extends on my classes, I'm trying to get this particular bit of code...

passing multiple parameters to resulthandlers in flex

Hi, Is there a way to extend the ResultEvent class in flex. i have the following code: var token:AsyncToken = remoteObject.setQueryAndGetPromptValues('country', queryString); token.addResponder(new mx.rpc.Responder(resultCountrySearch,faultCountrySearch)); var token:AsyncToken = remoteObject.setQueryAndGetPromptValues('c...

AS3/Flex Decorator Pattern

I'm trying to create a decorator class in AS3/Flex in order to add some functionality to a UI element. The problem is that I don't know how to automatically "redirect" method and property calls to the object being decorated. I suppose I'm looking for something like the __call() "magic method" from PHP, which is called every time the appl...

keyboard input with actionscript

I'm writing in pure actionscript in notepad with flex as a compiler. Here's the code I have package { import flash.display.*; import mx.core.*; import flash.events.*; import mx.collections.*; import flash.geom.*; import mx.controls.*; import flash.text.*; import mx.events.*; import mx.styles.*; impo...

Action script 3 - I need to know if a child object has changed it's size DYNAMICALLY ! help ?

Hi, I'm writing a sort of "dynamic gallery" in flash. The problem is that a child of the gallery can be resized in runtime, and then I have to rearrange the gallery. Now, of course, I can't overload the gallery items, since it's a display object which is unpredictable. and even if I could force overloading on the items, how will I be...

Migration from Flash CS3 to CS5: TextField rendering problem.

Hi I have an Actionscript project that was building using Flash cs3. Project have TextFields (Text engine: classic text, Text type: dynamic text). Since I upgraded to CS5 and published, I find out that my text not rendered. I use Font family Tahoma. And I just set Font family to Tahoma again and published. After that manipulations my tex...

Flash as3 spinning wheel

I am trying to create a spinning wheel with text on it. I have created the wheel and it is populating perfectly based on the colors that I supply to it. Now I am trying to add text to each of the parts of the wheel but am running into some problems. I cannot seem to get the text to display properly within each of the colors. I was hoping...