actionscript-3

Using internal in package gives error

I'm trying to place a class into a package where another public class is placed. The documentation says that only one external visible declaration can be put in a package. So i declare the second class internal. But then it gives the following error: 5006: An ActionScript file can not have more than one externally visible definition...

Create a weak reference to an object

Is it possible in Actionscript 3 to create a weak reference to an object, so that it can be garbage collected. I'm creating some classes to make debugging easier, so I don't want the objects to hang around in memory if they are only referenced here (and of course I don't want to fill the code with callbacks to remove the objects) ...

Display HTML in an Actionscript 3 project

Folks, I am pulling all my Flash (pure AS3 project, not Flash CS3) content from a Drupal back-end for SEO purposes. This works great, except the HTML rendering built into the TextField object leaves a lot to be desired. Could anyone recommend any libraries that would allow me to display HTML elements? At this stage, commercial or ope...

How to put an image (say, PNG) on a graphics in Flex 3?

I'm new to Flex, and I'm trying to write a simple application. I have a file with an image and I want to display this image on a Graphics. How do I do this? I tried [Embed]-ding it and adding as a child to the component owning the Graphics', but I'm getting a "Type Coercion failed: cannot convert ... to mx.core.IUIComponent" error. ...

Why should I use MXML?

If everything that can be accomplished in MXML can also be accomplished in ActionScript and many things are easier to accomplish in ActionScript (loops, conditionals, etc) why take the time to learn MXML? The best reasons I have at this point are that the structure of the MXML nicely matches the visual hierarchy of the UI components and...

GUI Framework for flash (as3)

I can't seem to find any GUI framework's for as3 that are as good as any the applications I already see out on the web; Is this something most people code themselves or am I missing something in flash itself? I'm looking for dialogs/windows, buttons, text boxes, combos, drop downs, menus, etc etc and the ability to extend the components...

Flex - Is there a way to specify what direction a ComboBox will open?

Maybe I should further qualify this - Is there a way to specify which direction a ComboBox will open without copying and pasting the entire ComboBox class and ripping out the code where it determines which direction it will open in... I'm my specific case - I need it to open upwards - always. UPDATE: You can't fix this by subclassing ...

General tips and techniques for minimizing the size of Flex applications.

I really like the Flex framework, however I routinely deal with SWF files that are ~ 500KB. I don't know at what point a file considered to be "too big" to be served on the internet, but I would assume that a 500KB download just to use a web application would certainly annoy some users. Are there any tips or techniques on reducing the...

Browser history for Flash (or AJAX)

What is the best tool / practice to enable browser history for Flash (or AJAX) websites? I guess the established practice is to set and read a hash-addition to the URL like http://example.com/#id=1 I am aware of the Flex History Manager, but was wondering if there are any good alternatives to consider. Would also be interested in a ge...

Can a Flash movie pass mouse events to the containing page?

One of our newer products is a walk-on video system, in which a character appears in an absolutely positioned DIV and gives a little presentation. We're using Flash 9, AS3. Unfortunately, in order to make him appear in front of the website content, we need to set his Z-index to a value higher than the page content. On some websites and ...

What's the difference between String(value) and value as String?

Just to make this clear - what is the difference between: String(value) and value as String What are the cases where you would use one over the other? They seem interchangeable... ...

Accessing parent properties/methods in Actionscript 3.0

I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using _root, but using root (since _root no longer exists) now gives an error: root.play(); "1061: Call to a possibly undefined method play through a reference with static...

Getting directory listing using Flash

In flash you can open a file on the user's computer. In flash 9 you can upload and download the file and in flash 10 you can access the contents of the file. It is secure because the user has to choose the file from a file dialog box to allow flash access to it. What I would like to do in my application is to get a directory listing of...

Access savedThis property in Function

When I'm in the flash debugger, and I have some callbacks saved, I can see that the functions have a property named savedThis that is very usefull to know where that callback came from. I'm trying to access that property from code, but for some reason I can't. callback.savedThis throws an Error because it can't find the property, proba...

Flex custom item renderer for the displayed item in the combobox

I am using a custom item renderer in a combobox to display a custom drawing instead of the default text label. This works fine for the dropdown list but the displayed item ( when the list is closed) is still the textual representation of my object. Is there a way to have the displayed item rendered the same way as the one in the dropdo...

Flex - XML Serialization and De-Serialization of nested Object structures

Our Flex app would like to work with requests and responses as object graphs (nothing unusual there) e.g. response becomes the model of some view, and would be a structure with several layers of nesting. ** Now, ideally we would like to use the same client (and server) side objects for different message formats e.g. XML and AMF, and hav...

How do I bind a function to a component programatically in Actionscript?

I am trying to provide my own labelFunction for a CategoryAxis programatically but am completely stumped. The regular way is to do it in your MXML file, but I want to do it in my Actionscript file. The regular way of doing it is: <mx:Script> <![CDATA[ private function categoryAxis_labelFunc(item:Object, prev...

Problem with class design and inheritance in Flash AS3.

I have problems with how to design some classes. I have three classes. One superclass, and two subclasses. One subclass (AnimatedCharacter) is made by flash, and is used to display the object on screen. The other (CharacterPhysics) is made by myself to extend the superclass. The problem is that the object I use, is of the type Animate...

Best way to make a flash "popup"

On my website I want a small flash banner which the user can activate somehow and it grows a lot larger to display a lot more information. I've seen advertising banners which annoyingly do this when you mouse over them although I'd want to ask the user to click a specific "more" button. I can think of two ways 1) Make the flash movie t...

What are some resources for optimizing ActionScript (flash) for speed and size

I'm especially interested in memory profiling, reducing the size of a compiled .swf, measuring network latency, etc. Also, I'm focussed entirely on AS3. ...