actionscript-3

Check if SoundChannel is playing sound

How to check reliably if a SoundChannel is still playing a sound? For example, [Embed(source="song.mp3")] var Song: Class; var s: Song = new Song(); var ch: SoundChannel = s.play(); // how to check if ch is playing? ...

Connect to self-signed HTTPS web services from Flex

In my project I need to connect to an intra-net web service but we need SSL connection between the two machines. Because this is an intra-net site the certificate of the web service might be a self-signed certificate. The web service and the web page that loads my Flex application resides on the same web server (tomcat) so when I load th...

Flex - Laying out text within a Canvas

Here's a problem I keep running into: I have a lot of situations where I need to display some text with a styled container like so: <mx:Canvas> <mx:Text text="{text}" left="5" verticalCenter="0" right="5" /> </mx:Canvas> As you can see - the text in constrained by the left and right margins of the canvas and I have not speci...

What is the easiest way to learn ActionScript when you know JavaScript?

Hi, I am an Ajax developer and I want to build a Flash application. Given my previous experience with JavaScript, what do you thing will be the easiest way to learn ActionScript and what are the obstacles I might encounter? ...

Embedding binary video data in a swf file

Is it possible to play video from data that has been embedded in a swf at compile time (with the [Embed] metatag)? The "Import Video->Embed" feature provided by Flash CS3 etc. is not acceptable because it has many severe limitations (including sound synchronization issues, a maximum number of frames, and other caveats) I'm interested i...

Loading a video from the local file system...

I have a swf that is run from C:/ in the browser instead of a server (long story) and that swf loads a video that it located at ../../videos/video in relation to that swf. Problem is, When I run it in Flex, everything is cool. Running locally, it can't find the file (not a security error) and is throwing a connectionError. Any ideas...

How do I get from an instance of a class to a Class object in ActionScript 3?

How do you get an instance of the actionscript class Class from an instance of that class? In Python, this would be x.__class__; in Java, x.getClass();. I'm aware that certain terrible hacks exist to do this, but I'm looking for a built-in language facility, or at least a library routine built on something reliable. ...

How can I disable horizontal scrollbars in Flex components?

I have a few GridItem components that gets filled with dynamic data. Sometimes this data longer than the GridItem's fixed width, causing the GridItem to get a horizontal scrollbar. How can I disable this (I'm assuming you can...) Is there a general style that handles this for other Flex components as well? Thanks. ...

Flex alert with TextInput as well as buttons

Does anyone know if it is possible to add other controls to a Flex 3 Alert? What I need is a modal dialoge that allows the user to type in a filename before clicking OK or CANCEL. This seems like it would be best achieved with an Alert but in the documentation I don't see an obvious way to add a TextInput (or any other control except a B...

How do I change the font used by the FLVPlaybackCaptioning component for subtitles?

How can I set the font used by the FLVPlaybackCaptioning component for subtitles? Using the style property of the textarea does nothing, and using a TextFormat makes the text go blank, even though the font had been embedded. ...

How are most AS3 Video Players Created?

Are most flash video players created all programmatically? Or they done using static buttons that are referenced in classes? Is it better to create all your buttons on the fly or does it not really matter? ...

MovieClip isn't removed from Dictionary

I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem. This code works great: var mc = new MovieClip(); var dic = new Dictionary(true); dic[mc] = 12; mc...

Dynamically change the xml file location that flash loads using c#

Hi, Can someone tell me how i can change the .xml file that a flash movie loads using c#. ie: i would like an ActionScript variable that defines the location of the flash movie. I would like to be able to change this variable using c# if possible. i dont really know how it would look, but something like: <object xmlpath='" + myCSharp...

Best way to tell if Event.COMPLETE has already fired for an <Image> in Flex

I'm looking for the best way to tell if an <mx:Image> has already fired the 'Event.COMPLETE' event. I want to do something if it has shown, or attach an event handler if it hasnt yet. something like : if (newBackground.percentLoaded < 100) or if (newBackground.content != null) i was originally doing newBackground.content != null, ...

Flash CS3 movie fails in browser

My AS3-heavy project tests fine in the IDE, but some parts don't work in the browser when published. Any ideas what could be causing this? ...

How do you learn a new skill/framework/technology?

I need to be able to contribute to a relatively large Adobe AIR project and I'm starting from scratch with this technology. What's the best way to go about it? I usually get a good book/tutorial and work my way through it but this time it seems there's just too much to learn for this to be feasible within a reasonable time frame. I woul...

how can I write a generic property modification function in Flex/Actionscript3?

I'm new to Flex, although not new to programming. I want to write a generic event handler that will be called by all my textinput boxes when they receive focus. When they have focus, I want to change the colour of the textinput box. When they lose focus, I want to restore the "inactive" color profile. I could write an ActionScript even...

Use commandline arguments in creationComplete

How can I use command line arguments in a creationComplete event handler? It seems the invoke event happens in my AIR app after creationComplete gets called, so I can't use the args in that function, although I really would like to. Any other event that might always fire after the invoke event happens? ...

FLASH/FLEXBUILDER: computeSpectrum stops computing the spectrum for no reason

I'm using flex builder to compile my SWF. Im using mp3's on my local machine and computeSpectrum() to analyze the mp3. After playing for 20secs, my computeSpectrum stops returning values, instead, it starts returning this error: SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: file:///C|/Documents%20...

Flex Builder 3: Debugger traces error, when fixing the as file, keeps throwing same error, stuck in past

I'm running my first project that I'm compiling with flex builder. Before I used to compile with flash or flash develop. For a while it worked pretty neatly. But as soon as it start throwing typeerrors, I can't seem to compile the updated and saved actionscript files. It seems as if it keeps stuck in time and compiles the actionscript f...