actionscript-3

Setting default value for function argument in actionscript 3

Is there any way that I can reference a var or const as the default value for a function argument in actionscript 3. I can define default values like null, string, int. function a( b = null ) { blah... } But what I want to do is function a( b = function(){} ) { blah... } which it seems like there would be a way to do. Presuma...

Is there a standard template for AS3 documentation?

I've seen it used a couple places: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/ http://developer.yahoo.com/flash/astra-flash/classreference/ Is this just a coincidence or is it somewhere I can grab? I'd love to use it for a new project I'm working on. Thanks! ...

Error in Flash addition

Make a new AS3 Document in Flash, paste in the following code and run it: var a:Number=0; trace(a) // 0 a+=0.3; trace(a) // 0.3 a+=0.3; trace(a) // 0.6 a+=0.3; trace(a) // 0.8999999999999999 a+=0.3; trace(a) // 1.2 a+=0.3; trace(a) // 1.5 a+=0.3; trace(a) // 1.8 a+=0.3; trace(a) // 2.1 a+=0.3; // ^ This is th...

Securing certain parts of an application.

Hi, If someone logs on to my application this user contains a dictionary with certain permissions. ex: module.view.workspace = true module.view.reporting = false ... Then we know to what parts of the application the user has access. What I want to know is how we can apply these permissions on the view. We are working in an AS...

Flex: Is there anyway to disable the textfield in the NumericStepper and force the user to change the value only by using the up/down buttons?

Probably not much more to elaborate on here - I'm using a NumericStepper control and I want the user to use the buttons only to change the value in the NS, not by typing into the control - I couldn't find a property to disable the text - does it exist? If it doesn't, how would I subclass this thing to disable the text? ...

How do I pass a dynamic url from xml into an onClick Mouse Event in ActionScript 3?

Im loading the xml in, and Im able to read the xml nodes into text fields in my flash. It is also loading the url, but the last one from the loop. Its not loading the one that I click on. I tried using event.target, but that is not working. Im pretty close to figuring it out, Im just not sure where to look. Any help would be greatly appr...

Accessing the Document class in AS3

How can instantiated classes access the Document class? Even after I name the Document class using the Properties bar in Flash, attempting to access it from other classes usually fails, saying "attempting to access an undefined property... One solution is always casting the Document class to itself! eg. Main(Main).globalMethod(); Bu...

How can I get list of properties in an object in Actionscript?

I have a dataprovider and a filterfunction for my array that's assigned to my dataprovider. How can I get a list of the properties that are in each row of the dataprovider (item.data) as it gets passed to the filterfunction? For instance, if my object contained: Object name email address Then I would want, in my filterfunction ...

What does this this ActionScript syntax mean? ( Syntax for returning Objects Inline )

Hi, I am a Java programmer and need to work on a Flex/ActionScript project right now. I got an example of using ITreeDataDesriptor from Flex 3 Cookbook, but there is one line of actionscript code that's hard for me to understand. I appreciate if someone could explain this a little further. public function getData(node:Object, model:Ob...

Flex: when hiding components in flex

When I set a component to visible=false the component hides, but how do I get it to take no space (get the container it belongs to to resize??) <mx:HBox width="100%" height="100%"> ... </mx:HBox> <mx:HBox width="100%" id="boxAddComment" visible="false" > <mx:TextArea id="txtComment"/> <mx:Button label="Spara" click="addCommen...

remove the right click menu in flash 9

Is it possible, using actionscript 3 to disable the right click menu? Any help greatly appreciated! ...

Getting progress on POST using HTTPService in Flex/AS3

I'm using HTTPService with a POST operation to submit a Base64 encoded file (taken from bitmap data within the app) but I could really do with getting some idea of the progress of the POST operation (e.g. like the FileReference.upload()). I don't think this is possible, but it would be awesome if it is (via any means, I'm willing to cha...

AS3 Timeline Variable issues

I'm trying to get a dynamic movie clip from the timeline. I have a timeline of unknown length with a movie clip with instance name "blah" on one of the key frames (assumed 88 in this case). No matter what I do, I cannot get a reference to the said movie clip. Here's what I tried: trace(blah); // null trace(this.blah); // null trace(g...

Trouble with ActionScript 3, not working, and i have no idea why, flash CS4

Hello I'm very new to ActionScript 3, and I've followed this toturial on adobe TV. But I don't get it to work. The thing is that I want the box to move left/right when I click the buttons, but nothing happens. You can download the .fla file here: http://www.habitats.no/files/AC3.zip Thanks. ...

How to determine last deselected item in a TileList?

My TileList has allowMultipleSelection on. I am using itemClick to call a function. I can use listEvent.currentTarget.selectedItem to determine what object was just clicked on if I am selecting, but when I ctrl + click to deselect an item, it automatically selects something else in the TileList, thus changing the selectedItem. It seems l...

Finding (loaded) image size in AS3 (Action Script 3.0)

Im currently using the following function to load an image, however i could not figure out a way to find the width of the loaded image, which i intend to use before placing the next image using the same function. Note that q is a a variable (a number) which is used to load differant images. =X i need help obtainning the loaded image w...

as3 tween - how do i keep from images with drop shadows going straight black?

I am using AS3 to create a tween affect between multiple images that have a drop shadow around them - it works great, except after 3+ tweens the drop shadow starts getting darker and darker - that makes sense, but not really want i want to happen. Ideally i would like to tween between 2 images, on the 3rd clear it out or something? I a...

Elastic collision between oblique wall and ball

Hi, I'm having trouble computing reflection angles for a ball hitting an oblique wall. I'm using an algorithm lifted from this tutorial. It looks like this (in Actionscript 3), with p1 being the current velocity vector and p2 the normal of the wall: private function getReflect2(p1 : Point, p2 : Point) : Point { var wallvec : Point = g...

How can my Flash app determine its own URL?

My flash app needs to know its own URL, so that it can load some (non-embedded) content using relative paths. (I cannot hardcode the full paths because there will be multiple installs -- staging, production, etc. Nor can I use simple relative paths because there's one legacy install that uses a different relative path (ugh). And I c...

Actionscript 3.0, why is it missing good OOP elements?

Anyone who has programmed with actionscript 3.0 has most certainly noticed its lack of support for private constructors and abstract classes. There are ways to work around these flaws, like throwing errors from methods which should be abstract, but these work arounds are annoying and not very elegant. (Throwing an error from a method tha...