actionscript-3

visual change notification event?

Anybody that happens to know how to do this would really be helping me out. Maybe its simple, I don't know, but it involves embedded SWF's so I imagine it could entail interacting with event handlers or methods in an embedded SWF. But anyway, here it is: I have several embedded SWF's on a canvas (in SWFLoaders) and when one of them ch...

"access of possibly undefined" actionscript

I've created a SittingDuck.as class that extends the MovieClip class. When I instantiate SittingDuck in my .fla file, I try and access both the properties I created in the SittingDuck.as file, as well as its inherited properties. I'm able to refer to and change x and y properties, but when I attempt to access the instanceName property, I...

SWF file not reliably loading from server

I have created an application using Adobe Flex. I took all the files from the 'bin-release' folder and put it on the server. Then when someone connected to the server through http it is forwarded to the "index.htm". The "index.htm" page is the HTML page created automagically by Adobe Flex during compile time, I just renamed it to that...

Flash vertical text alignment in middle

Hi there, I've been looking for a way to programmatically and by default set a dynamic text box to vertically align in the middle of the box. I find it really hard to believe that there's no option to do this, unless I'm excessively blind. Else how can I fake it? Thanks! ...

Flash AS3 with HG version number?

I'm using ant, hg, and the linux Flash as3 libraries to compile. I would like to include some sort of version info automatically, for debugging purposes. ...

Fastest way to take a Screenshot in Flex 3?

What's the fastest way to get a screen capture in flex? I am currently using: (I currently encode it to Base64 for upload to a webserver, but this is not necessarily required. All I want is an image file to appear on the server). ImageSnapshot.defaultEncoder = JPEGEncoder; var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(<...

Proper way to dispatch/handle message in actionscript 3?

I have a constructor in a class that does some kind of logic: public function Constructor() { if some condition { // load some resource from the internet, dispatch message when done } else { // finish up, dispatch message now dispatchEvent( new TestEvent( ... ) ); } } and a class that uses this: obj = ne...

finding objects within radius.

looking for a light weight way to find objects within a radius. so far the answer that is obvious to me is go through each object, comparing its x and y position, with the center of the radius. example: Turret - looking for targets in radius. TargetArray - array of possible targets. WithinRangeArray - array we push applicable targets...

How do I setup a game room in pure actionscript?

Height, Width, Background Color, placing objects in the room and such. Can anyone help me? ...

Actionscript 'Object' labeled as a real datastructure for readability

So in actionscript 3, instances of the Object class can be used an as associative array: var doNotHaveSexWith:Object = new Object(); doNotHaveSexWith['mum'] = new Person(...); doNotHaveSexWith['dad'] = new Person(...); doNotHaveSexWith['dave'] = new Person(...); Say I have some class, and one of it's members is a read only 'Object' wh...

Flash: Using mouse wheel events in full screen mode (Windows and Mac)

Although Flash has a mouse wheel event (MouseEvent.MOUSE_WHEEL), it comes with quite a few problems. The first is that the event is not yet supported on the Mac. So there are a bunch of solutions, all of which (basically) capture the mousewheel (or DOMMouseScroll) event in javascript and pass it into the flash app. Luckily, under all t...

AS3-Facebook: How do I capture the RawResult for calls like for friends

Hi guys, I am using Flex and with the AS3 libraries. I can make calls etc but when i get values returned in the event, they are in RawResult. I am not sure how to turn that into an arraycollection etc so i can make use of it in flex, or if there is a better way of accessing the data, generally speaking. tried= var friendsDoc : XMLDocu...

ActionScript 3 & font embedding

hey! I have a problem with doing proper font embedding in a actionscript 3 project (flash CS4, not flex). I followed this Adobe guide to do font embedding: http://www.adobe.com/devnet/flash/quickstart/embedding%5Ffonts/ the guide tells to set the Textfield.embedFonts property to true. if I do so and try to display a text with another ...

Dynamically detect XML child

How to know if a XML list have a child? My code below is using hard code stating that I want to run the child of my XML. But I wouldn't want to write write every children() of it if I have a lot of child. private function dataLevel():void { for (var j:Number=0; j<xmlList.length(); j++) { createBranch(); for (var k:int = 0; k<xm...

Asynchronous Errors in Actionscript: Exceptions? ErrorEvents?

So I have two classes: IOPin & Node A Node has a set of IOPins. To support loose coupling, and separation of concerns, I don't want the IOPins to have to know anything about Node. The Node should deal with adding/removing IOPins and should also deal with any error checking logic associated with this. This causes an issue when I want ...

ComboBox selectedItem in Flex3

Hi, i am working in Air application in Flex3 , i need know how to set "selectedItem" Property when we have 2 values like(data and label) label property to combobox selection, data value for our input. Like shown below. In (selectedItem="{stylename}") stylename will have "data" value but i need ...

get XML assigned MC properties

I've created an amount of MC based on my XMLlist, and each assign with an attribute/ID stated in the XML. I'm now trying to trace back the parent of the assigned MC properties, how could I do that? The XML: <MEMBER NAME="Todd" ID="001"> <MEMBER NAME="Popia" ID="003"> </MEMBER> <MEMBER NAME="Popia2" ID="004"> <MEMBE...

How to control main timeline from external swf

I have a main.swf and inside it is just a plain container movieclip. Using the Loader function I load an external swf called content.swf inside that container. Container.swf has a button inside it. Now when external swf is loaded in container mc which is on the main.swf stage, I want to move to another frame by clicking the button of th...

Passing extra argument to an event.COMPLETE listener function

I am adding some tabs to the stage, and each tab loads its own swf file. I have an array tracking the tabs, but need to know when each swf is loaded which tab it belongs to. I'm not sure of the best way to do it. Tabs are controlled by XML, so there can be any number of tabs - for (var j = 0; j < _xmlTabs.length(); j++) { arrTabs...

Flex 4: Build a Group with a background

I'm trying to build a simple component extending spark.components.Group to have a background color, more specifically a spark.primitives.Rect component stretched to fill the background. This is what I've come up with thus far: <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="libra...