actionscript-3

AS3 - swfaddress deep linking when someone pastes a url

I have swfaddress (2.4) working fine on my site - the back button works, I can copy and paste urls and be taken to the correct page, etc. BUT, if I copy a url, say "http://mysite.com/#/bio", and paste it into a new browser window, the site always just loads to the home page after the preloader. What am I missing? Do I somehow need to ch...

How to expose a method in an interface without making it public to all classes

I have a issue where I'm working with a particular interface for quite a lot of things. However, I have a particular method that I want to be available only to a particular group of classes (basically, an internal method). interface IThing { function thisMethodIsPublic():void; function thisMethodShouldOnlyBeVisibleToCertainClas...

Stack of photos AS3 - stuck on somthing simple

Hi there I found a tutorial on creating a stack of photos in flash using AS3 (http://designreviver.com/tutorials/create-an-interactive-stack-of-photos/). I have been trying to make a dynamic XML version of the photo stack and I have a problem (obviously :) I have a class called Polaroid, and im using a loop to add multiple instances o...

AS3 - Accessing attributes of a static variable of an object from another object

I have 2 classes, Display holds the currently selected Component: public class Display { public static var selectedComponent:Component; } Component has an ID string and the selectedComponent variable is set on click: public class Component extends MovieClip { public var id:String; addEventListener(MouseEvent.CLICK, function() ...

How to properly test for class inheritance in ActionScript 3?

In ActionScript 3, you can figure out whether object O is of class C or of a class that extends or implements class C (directly or indirectly) using... if (O is C) { ... } What I want to do is to test whether class CC extends or implements class C (directly or indirectly), without having to instantiate an object. In Java, you wou...

how to query if flash has focus

I know I can detect flash gaining and losing focus with these callbacks: stg.addEventListener( Event.DEACTIVATE, deactivateCb, false, 0, true ); stg.addEventListener( Event.ACTIVATE, activateCb, false, 0, true ); But is there anyway to directly query flash if it has focus or not? (Trying to figure out if flash has focus when starting...

Fail to target a instance inside a MC in an Array

I can't trace whats inside holderMC, and its content. What's wrong here? instance.text="something" holderMC.addChild(instance) anArray.push(holderMC) addChild(holderMC) trace(anArray[anArray.length-1].instance.text); returned undefined. ...

Manipulate my flash depending on a URL?

I have a flash map of the UK which is divided up into the counties, a user clicks on a county and is then directed to a new url, eg. www.mydomain.co.uk/region/london. The flash map remains on that new page in case they wish to select a new region. What I want to know: is it possible to manipulate the flash so that if the url is www.mydo...

AS3 - Child moves parent using startDrag

I have a MovieClip instance which can be moved around the stage using startDrag() and stopDrag(). The instance also has some child MovieClips using addChild(). The parent moves the children when dragging, which is fine. The children have there own startDrag() and stopDrag() which should apply only to the child object, however it also mov...

recommendation for html parser library in as3 for flex project

Hi, Can somebody recommend a simple html parsing library, written in as3 for a flex project? Thanks, Nava ...

Knowing object from where in XML

I'm trying to know the MC I clicked, is from which line of code in my XML files. for (var i:Number=0; i<myXML.children().length(); i++) { addChild(someMC) } someMC.addEventListener(MouseEvent.click,clicky) ...

How to make an object be ignored and letting mouse evnets pass through?

Hallo, I been having this problem for a while and I have no idea how to solve it. I have a flash game (very much like a normal memory game) that has a lot of Movieclips in it that has MouseEvents attached to them. But, when I add a bitmap over the stage (used for covering lots of unwanted things and has to be there) that is the full siz...

Can't reassign value to text field the second time

The code below when it 1st load, i assign a pageName for selectedIDtext for it. And when the second time it loads I wanted to remove the data init and update with a new pageName. But no matter what I did i can't change and assign the 1st value that was loaded in the textfield. selectedIDmc=new MovieClip(); selectedIDtext=new TextField()...

Best method to scale DropShadows in AS3?

I'm creating a flash application that makes use of both the dropShadow filter and scaling of various sprites. And therein lies the problem: This filter supports Stage scaling. However, it does not support general scaling, rotation, and skewing. If the object itself is scaled (if scaleX and scaleY are set to a value other tha...

fl.video.VideoPlayer loads flv relative to swf?

Update: Turns out this is undocumented behaviour of the NetStream class - NetStream loads relative to the swf, as opposed to URLRequest which loads relative to the HTML doc... annoying. I am having a strange issue where loading an FLV file using the fl.video.VideoPlayer class that comes with CS4: Adobe docs here Usually when loading ...

Detecting alt keyDown keyboard event in Flex

I am trying to detect the key down event for the alt key in flex. I have a standard event listener for KeyboardEvent.KEY_DOWN and KeyboardEvent.KEY_UP but don't get any response for the alt key (or ctrl key). I know I can detect if the alt key was pressed via a mouse event, but I want to update the cursor when the alt key is pressed to ...

How to build a dynamic resize-able Flash player

Morning stackers! So my question today isn't dealing with any code, but how to go about this the correct way from the start. I have a video player built to a static size (max: 800x600) which I'll have to re-code every time I need it to be a different size. What I need it to do in the near future is dynamically resize itself and all the ...

Wrong getBounds() on LineScaleMode.NONE

I have write a simple example that adds a canvas and draw a rectangle with stroke size 20 scale mode none. The problem is that if I call getBounds() first time I will get a correct result but after I call scale(); the getBounds() function will give me a wrong result. It will take in cosideration the stroke but stroke has scalemode to ...

AS3 try/catch out of memory

Hi, I'm loading a few huge images on my flex/as3 app, but I can't manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont know what to catch): try{ images = new Array(frames); for (var i:uint = 0; i < frames; i++){ imagesBA[i] = new Bitm...

What's a good way of deserializing data into mock objects?

I'm writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I'd prefer not to generate the data in code like this: var mockData = new Array(); mockData.push(new Foo(1, "abc", "xyz")); mockData.push(new Foo(2, "def", "xyz")); ... Rather I'd like to store the data in...