actionscript-3

Implicit vs explicit getters/setters in AS3, which to use and why?

Since the advent of AS3 I have been working like this: private var loggy:String; public function getLoggy ():String { return loggy; } public function setLoggy ( loggy:String ):void { // checking to make sure loggy's new value is kosher etc... this.loggy = loggy; } and have avoided working like this: private var _loggy:String;...

How to set tooltip for buttonbar button

I have a buttonbar that has 3 buttons. I'm trying to set a tooltip for each of the buttons, but not sure where. The ButtonBar itself has a skin, which in turn includes a skin for each of the buttons. <s:ButtonBar id="bb" selectedIndex="0" skinClass="skins.bbSkin"> <s:dataProvider> <s:ArrayList> <fx:Object la...

String replace method not doing anything in Flex 4 app

I have a string called userEmail in my Flex 4 app that has a value of: my%40email.com I need to have an @ symbol instead of %40, so I run this line: userEmail.replace("%40","@"); But the string has the same value after. What am I doing wrong? Thanks for reading. ...

FileReference.download() not working

I'm building a Flex app which requires me to download files. I have the following code: public function execute(event:CairngormEvent) : void { var evt:StemDownloadEvent = event as StemDownloadEvent; var req:URLRequest = new URLRequest(evt.data.file_path); var localRef:FileReference = new FileReference(); localRef.addEv...

Is there something wrong with this code? AMFReader vs AMFWriter

Something doesn't seem right about the source code for Flash Remoting's Date(AS3) <-> DateTime(.NET) stream reader/writer methods, when it comes to handling UTC <-> Local times. It seems to write the DateTime data fine, including a 64-bit representation as milliseconds elapsed since Jan 1, 1970, as well as a UTC offset. public void Wri...

AI opponent car logic in car race game.

hello i want to develop AI car(opponent) in car race game what should be my direction to develop them with less complexity because i don't have any idea. because the player car is moving on the scrolling track plz suggest me should i have to use relative motion or way point concept but that should also be change on the scrolling track (...

Embedd fonts in a TextArea in Flex4

Hi, I'm trying to embedd fonts to use with a TextArea that I have extended using the code below, but it doesn't work. I have used this code before with a TextFlow object and then set the containers with the flowComposer, but I can't get it to work with the TextArea. When using the code below and set the text with setText, all I get is ...

How to create a light effect inside a rectangle in Actionscript 3 ?

I have tried to do this here http://wonderfl.net/c/9Kdv but what I want is not this but rather the equivalent of this. As I'm flash newbie I don't see how: action script 3 code below: package { import flash.display.*; import flash.text.*; import flash.net.URLRequest; import flash.filters.*; import flash.geom.R...

invalidateList(); in flex3.0

please tell me what invalidateList(); function does? i have one line of code, in which this function is getting called on arraycollection object like dg.invalidateList(); where dg is the id of datagrid, dataprovider for this dg is colors which is an arraycollection?? plzz tell me wht the invalidateList() function is doin? thanx ...

How to exclude classes exported for actionscript in AsDoc

I am trying to use AsDoc on the code of one of my projects in flash. Some of the classes that I use inside the code are "exported for actionscript" classes from my FLA file. Of course the AsDoc compiler complains that those classes are not defined anywhere. Does anyone know how to make it ignore these class types? ...

ActionScript Custom Class With Return Type?

i just know this is a dumb question, so excuse me in advance. i want to essentially classify a simple function in it's own .as file. the function compares integers. but i don't know how to call the class and receive a boolean return. here's my class package { public class CompareInts { public function CompareInts(small:int, ...

In Flex/AIR, how can I keep a loaded SWFs stage property localized to that swf?

Does anyone know of a workaround for loading an AS3 swf into an existing AIR/Flex (Flex 3) application and having the loaded SWF retain its own reference to its stage (not the loader's stage)? I've tried the loadForCompatibility property on SWFLoader, but that isn't giving me the behavior I'm wanting. The loaded swf still has the main A...

How do I set if a node is a branch or a leaf?

I have a tree being populated by an array collection. I don't have control of the data in the array collection and even when a node has no children it still has a "children" property that is causing my tree to treat every node as branch. I can do a simple check on the length of the array in the children property. If this is 0 I need the ...

ActionScript Reading A Vector's DataType?

is it possible to read the datatype of a vector? var vec:Vector.<int> = new Vector.<int>; trace(the datatype of vec); //ideally this would output 'int' ...

Maximize an AIR app using the keyboard

Hi there, This boils down to being able to listen to key presses when the application doesn't have the focus. I've tried adding listeners to both stage and NativeApplication, but when the app is minimized it doesn't seem to listen to key events. Any idea how this could be achieved? Just for the record, I'm trying to implement an app t...

Increment global variable on click in flash, actionscript 3

Hi, Making a flash page that can cycle through these three images on mouseclick. For some reason the local changes to count are not reflected on the global one. I tried _global but the syntax was odd and gave me errors. How should I implement this? import flash.events.Event; var images:Array = ["images/image.jpg", "images/image2.jp...

AS3 How to center MC + change background color?

Hello everyone, I am quite new to AS3 and I have never worked with classes, so I am encountering a couple of problems. I'd like to center a movieclip, have it so that it doesn't scale. And then I'd like to add a background color that stays there no matter how I scale the browser. Can someone please explain me this in babysteps? Since ...

Help on Removal of Dynamically Created sprites.

import flash.display.Sprite; import flash.net.URLLoader; var index:int = 0; var constY = 291; var constW = 2; var constH = 40; hydrogenBtn.label = "Hydrogen"; heliumBtn.label = "Helium"; lithiumBtn.label = "Lithium"; hydrogenBtn.addEventListener (MouseEvent.CLICK, loadHydrogen); heliumBtn.addEventListener (MouseEvent.C...

How to pass PHP variable as FlashVars via SWFObject

I am trying to take a PHP variable and pass it along to Flash via Flash vars. My end goal is to pass a string formatted as XML to Flash, but because I'm struggling I've stripped everything down to the basics. I'm just trying to pass a simple PHP string variable to Flash via FlashVars with SWFObject but something isn't right. The page won...

Multiple loadmovie() ends up with multiple videos played at the same time!

Hi, i use loadmovie() to load youtube videos inside my flash website but when i load another video the old one doesn't stop, so i tried unloadmovie to destroy it but it seems that i did a mistake in my code This is how the code looks to stop the old one an load the new: vloader.unloadMovie(); vloader.loadMovie("http://www.youtube.com/v...