actionscript-3

Flash AS3 url link to open separate swf in an iFrame

Hello, I'm trying to use my swf Menu to change the Content swf below it which is in an iframe so the menu doesnt have to load each time, but having trouble linking the buttons.. My flash code is: homeButton.addEventListener(MouseEvent.CLICK, homeButtonFunction); function homeButtonFunction(event: MouseEvent) { var targetURL:URLRequest ...

how to pass an object from a windowSWF to JSFL ?

I'm working with an fla, an as file(document class), and a jsfl file. the swf is generated in the WindowSWF folder (e.g. $flash/WindowSWF) I have a simple windowSWF and I'm using MMExecute and fl.runScript to pass variables from as3 to jsfl. I didn't imagine I would run into trouble if I would use objects though. In my windowSWF I have...

Unloading objects for the garbage collector in AS3

I've created an object called loginInterface in flex builder. When this object is initialized it loads the login interface, creating buttons, input boxes and so on. I created a method for this object called unload. I also have a method which returns whether the interface has been loaded yet. Now, I want to unload the object so that the ...

Creating a public function in object oriented programming (flash)?

I'm new to object oriented programming and flash. As far as I know, global variables and functions are evil things. We have to use objects, right? So far everything is going pretty well, apart from when I want to eg. create a log function which will write a debug message to a textfield object. The problem is that I need to be able to u...

AS3 bitwise shift 0?

I came across this in some AS 3.0 code: (duration >> 0) Where duration is a Number. I think I know what a bitwise right shift does, but what's the point of shifting 0 bits? This happens a few times in the code, I'd like to understand what it does. ...

action script 3 and custom image itemrenderers

Hi, I have a custom item renderer which displays a different gif in the row depending on data value from the data object. When i set the image source url using the absolute path and not embedding it works fine however when i embed the images i find that when i scroll up and down the grid the images get messed up and sometimes sit on top...

AS2 .swf loadmovie() and unloadmovie() fail when nested inside an AS3 .swf container

I have an AS2 .swf being loaded as a child of a parent AS3 .swf. The AS2.swf calls loadmovie() and unloadmovie() to display 3 jpeg files. The images load the first time, but after that, a call to loadmovie() to replace the image, or a call to unloadmovie() fail. I found the following Adobe Bug report (https://bugs.adobe.com/jira/brows...

Actionscript 3 vs haXe: Which to chose for new Flash project?

I am in the planning stages of a new Flash game project and was wondering which language would be better to use? I already have a strong understanding of Actionscript 3, and have not worked with haXe yet, but i have read the language reference docs and it seems that haXe has some of the features from my other favorite languages, C# and R...

Set Flex component width to 100% at runtime?

If I am creating say a input field through MXML, I can set the width to 100%. But I cannot seem to do this at runtime through ActionScript. This works: <mx:TextInput ... width="100%" /> This wont compile, says width is a number, not a string: var textinp:TextInput = new TextInput(); someContainer.addChild(textinp); textinp.width = "...

Flex Component Lifecycle with Menus - best practice

I have built a multiplage application in Flex with different user roles. I use a View Stack with a Menu Bar to navigate between the different pages. However - each time a page gets opened, I need to do some database calls, apply User Role settings, etc. in an init() function. This init function may reference some UI elements of this pag...

Different methods for type casting in ActionScript 3

What is the difference between: Car(someObject).isRacing; and (someObject as Car).isRacing; Thanks in advance! ...

tabIndex fails in an AS3 swf loaded into a flex app

I feel like I'm missing something really simple here. I'm loading a AS3 swf containing a form (created by one of our designers) into a flex app. The swf's tabIndex properties work fine when the swf is viewed by itself, however, once it's loaded into the flex app: <mx:SWFLoader source="form.swf" top="20" horizontalCenter="0" id="formSwf"...

Best way to reuse an element from an Array?

I have a Array of Characters objects (extends Sprite). public static var charlist:Array; When a Character die, I set a flag to indicate that. char.die = true; When I spawn a new player, I check against this flag, to reuse the slot. This is where the problem comes. What is the best way to do that? Actually I have this approach: cha...

menu bar control in flex ,needed to handle separate method for individual menu item.

Hi, i need to fire separate method for individual menu item clicked ,so that individual item can handle separate method. and i need know what all the properties are available in menu item like type="radio". <mx:MenuBar id="jj" labelField="@label" itemClick="MenuItemClick(event)" x="23" y="228"> <mx:XMLList> <menuitem l...

Array not iterable if associatively used

Hi when I have an array in actionscript var arr : Array = new Array(); arr["fsad"] = 1; trace(arr.length); and now put an entry to it with an associative string and afterwards count the length I get a length of 0 but why? How can I iterate it now? Thanks in advance Sebastian ...

Get the users screen res in as3

Hi all, I was just wondering if there is a way as3 can detect the users screen resolution? Regards Mark ...

AS3: in addEventListener external anonymous function is not running

Basically I have this function: private function clickURL(url:String):Function{ trace("Function has been instantiated"); return function(event:MouseEvent):void{ trace("Function has been run"); ExternalNavigation.newBrowserWindow(url); } } The purpose of this function is to take an url, put the url in another fun...

Flash Contact Form; Trouble Returning Server Response

I have a contact form that connects to my site's back-end, the form submits just fine but I get no server response. It's always 'undefined'. I'm worried it may be because of this, but I was hoping maybe one of you smarter folks could help me find either a workaround or if it isn't because of that (note: most likely), then maybe you could...

Flex: given Class object, get the name of the class it represents

In Flex, say I have a Class object. How do I get a string for the class it represents? e.g.: var clazz:Class= String; trace(clazz); // this gives "[class String]" but what I want is "String" ...

How can I check for the existence of an XML node in Flex/AS3?

Why does the trace in the loop below return false for every iteration, even though there ARE nodes named with 6 of the 8 possible values??? This only happens when I have a namespace. Is there some other way to check for the node values??? <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" la...