lundi 31 août 2015

Actionscript 3 How to Accelerometer without jerking

I am creating a 2d Car Game in Flash.

A Car is moving with a Accelerometer with * 30

When I Check it on device it will jerk car on tilting to move in x position

function AccelerometerUpdateHandler(event: AccelerometerEvent): void {
            car.x -= event.accelerationX * 30;
            car.y += event.accelerationY * 0;

I wanted to make it normal turning at 30 speed without jerking the car. (like ease)

How do I make FlashDevelop the default IDE for Adobe Flash Professional?

How do I make FlashDevelop the default IDE for Adobe Flash Professional? So that if I try to open an .as file from Adobe Flash Professional, it opens in FlashDevelop instead?

I am coming from Unity where there is just an option in preferences to set your default IDE, but I am struggling to figure it out here in Adobe Flash Professional.

How to compile actionscript worker swf in FlashDevelop

I already know the coding part of actionscript worker. Recently I switched my IDE to FlashDevelop. I can't figure out how to compile actionscript worker swf in FlashDevelop.

I try to use Tools - Flash Tools - Build current file. But it throws error saying Error: Type was not found or was not a compile-time constant: File. Maybe it is because my project is a AIR project and I use AIR API in my worker.

I also try to compile worker swf using amxmlc via command line. It compiles successfully. But AIR Debug Launcher crashes when executing worker swf part. The swf which I compiled by myself is nearly half size of the former one that Flash Builder generated for me. I guess I compiled a release version swf so that ADL can't debug and then crash.

So how do I compile a worker swf in FlashDevelop to debug or to publish a release of project?

as3 air ipad calendor

I have 3 buttons that hold the users date of birth, I want once the first button is pressed a choice of 31 days comes up to choose the day of the month, and then when the second one is pressed all the months come up and they click on the one they want and then the same for year.

Is there anything like this online?


Why my code is wrong?

I'm trying to make a space fighter game and i got a code for shooting but i don't know what's wrong.Maybe someone can help me. I make it in action script 3 and it shows me an error code 1014

package  {
import flash.display.MovieClip;
public class bullet {
public var root:Object;
public var speed:Number = 10;

public var cTime:Number = 0;
public var cLimit:Number = 12;
public var shootAllow = true;
    public function bullet() {

        addEventListener(Event.ADDED, beginClass);
        addEventListener(Event.ENTER_FRAME, ee);
        private function beginClass(event:Event):void
            root = MovieClip(root);
         public function ee(event:Event){



AS3 - Communicating between timers and loops

I have two classes, one with a loop and one with a timer and I am trying to send data from the timer to the loop.

Here is the relevant part of

var zero:int = 0;
var shoot:Shooting = new Shooting(zero); //send zero to class Shooting
while (shoot.finished == 0)  
{; //here data to move an object, rest is irrelevant...

Relevant from class

public class Shooting extends Sprite
private var twenty:int;
private var remove:int;
public  var _isPassed:int = 0;
private var thedata:int;
public var finished:int = 0;

    public function Shooting(data:int):void
    thedata = data; // store the zero
    var updateTimer:Timer;
    updateTimer = new Timer(1, 30); 
    updateTimer.addEventListener(TimerEvent.TIMER, Fire);

        public function Fire(e:TimerEvent):void                                                         
        for(var i:int=thedata; i >= 0; i--){ // data is bigger or = to 0 so keep going
        if (_isPassed == 29)
        finished = 1;
        _isPassed = 0; 
        //do more stuff and break
           // it will go here if it's not the 29 time and do +1 to ispassed.
            _isPassed += 1; 
            var atwenty:int = 20;
            twenty = atwenty;


So, in Main.class there's a "while" that checks if finished == 0(by default it is), if so it will move an object. In, there's a timer going on 30 times and in the 29th time it is supposed to stop itself(which it does), and change the var finished to 1. problem is, while does not detect that "1" and it keeps moving that object and my flash crashes. I am looking for a better way to communicate between timers and classes, and also figure out what I did wrong.

Thank you.

Adobe Flex collapsible panel in flex 4.6

i am quite new to Adobe Flex and im currently trying to build a collapsible Panel as Sidebar (sidebar extends panel) for my mobile application. My problem is, that the tutorial I followed , was built with Flex 4 and I am using 4.6. However, I have no errors, only a warning, telling me that "the CSS Typeselector of my SidebarPanel component wasn't processed, because the type is not used in the application."

I tried to run it, but all my Flexbuilder does, is showing a normal blank panel, without a button, change the skinstate. The point where I am stuck, is the grouping of all title bar layers and adding the button. I did both, but still got the blank panel.

I put the "titleBarGroup" from the tutorial arround "contents", "topGroup","tbHilite", "tbDiv" and "titleDisplay" and the "collapseButton" after the "contents"-group.


   <!-- layer 3: contents -->
<!--- Contains the vertical stack of titlebar content and controlbar. -->
<s:Group id="titleBarGroup" left="0" top="0" right="0" bottom="0"
         maxHeight="32" rotation.collapsed="90">
    <s:Group left="1" right="1" top="1" bottom="1" id="contents">
            <s:VerticalLayout gap="0" horizontalAlign="justify" />

        <!--- @private -->
        <s:Group id="topGroup" mask="{topGroupMask}">

            <!-- layer 0: title bar fill -->
            <!--- @private -->
            <s:Rect id="tbFill" left="0" right="0" top="0" bottom="1">
                    <s:LinearGradient rotation="90">
                        <s:GradientEntry color="0xE2E2E2" />
                        <s:GradientEntry color="0xD9D9D9" />

            <!-- layer 1: title bar highlight -->
            <!--- @private -->
            <s:Rect id="tbHilite" left="0" right="0" top="0" bottom="0">
                    <s:LinearGradientStroke rotation="90" weight="1">
                        <s:GradientEntry color="0xEAEAEA" />
                        <s:GradientEntry color="0xD9D9D9" />

            <!-- layer 2: title bar divider -->
            <!--- @private -->
            <s:Rect id="tbDiv" left="0" right="0" height="1" bottom="0">
                    <s:SolidColor color="0xC0C0C0" />

            <!-- layer 3: text -->
            <!--- @copy spark.components.Panel#titleDisplay -->
            <s:Label id="titleDisplay" maxDisplayedLines="1"
                     left="9" right="3" top="1" bottom="0" minHeight="30"
                     verticalAlign="middle" textAlign="start" fontWeight="bold">

        <s:Button id="collapseButton" width="16" height="16" top="7" right="7"
                  label="-" label.collapsed="+" toolTip="Collapse" toolTip.collapsed="Open" />


<s:Application xmlns:fx="" 
               xmlns:customskins="skins.*" applicationDPI="160" xmlns:skins="skins.*">
        <!-- Platzieren Sie nichtvisuelle Elemente (z. B. Dienste, Wertobjekte) hier -->
            import skins.SidebarPanelSkin;

        @namespace s "library://";
        @namespace cc "customcomp.*";
        @namespace customskins "skins.*";

            skin-class: ClassReference('skins.SidebarPanelSkin');


    <cc:SidebarPanel id="collapsiblePanel" >



Is the error resulting from my not processed typeselector or is there another error in my code? Another question is, whether there are any docs on transitioning from Flex 4 to 4.6. Found some stuff concerning 3 to 4.6, but not much more.



How to handle lock to aspect ratio sizing race condition?

I'm having some trouble getting a lock to aspect ratio to work correct. I think I have the algorithm correct but when I change one value it changes the other. Can anyone see how to properly handle the math for aspect ratio sizing?

Let's say I have an image 1440x900. If I enter 100 in the width it gives me 62.5 in the height. If I go into the height and change that to 62 and press enter it changes the width to 99.2. If I put the cursor in the width and change it to 99 it changes the height to 61.8 and so on.

Sometimes I don't have to change either value. I just put the cursor in the field and remove it and it changes the other value.

Here is my code:

if (property==WIDTH) {
    widthValue = Number(textInput.text);
    if ("sourceHeight" in target) {
        heightValue = (target.sourceHeight/target.sourceWidth)*widthValue;
    else {
        heightValue = (target.height/target.width)*widthValue;
    //heightValue = int(heightValue*roundingConstraints)/roundingConstraints;
    heightValue = int(heightValue*roundingConstraints)/roundingConstraints;
else if (property==HEIGHT) {
    heightValue = Number(textInput.text);

    if ("sourceHeight" in target) {
        widthValue = (target.sourceWidth/target.sourceHeight)*heightValue;
    } else {
        widthValue = (target.width/target.height)*heightValue;

    //widthValue = int(widthValue*roundingConstraints)/roundingConstraints;
    widthValue = int(widthValue);

I was trying to support subpixel values but will round to integers if I can't solve this. I think it has to do with the way JavaScript etc is adding or rounding numbers. I had this problem earlier today. I might be storing values such as .0900000000001 instead of .01.

Anyway, I'm working on rounding to int now and hope I do not have the same problem.

Creat Boundaries

Hello Everyone again :) I'm having an issue with boundaries actually about creating boundaries. In my stage I got 2 mc's names : Dispenser and Puller. Dispenser creating particles and puller is pulling them. I just need to set a boundary like a path.enter image description here
But i couldn't so asking for your help :)

Bdw the code is from this site :

    import flash.display.BitmapData;
    import flash.display.Sprite;
    import flash.display.MovieClip;

    public class Main extends Sprite
        // you can play around with these
        private var particlesTotal:Number = 50;
        private var particleSpeed:Number = 10;
        private var particleFadeoutSpeed:Number = .0175;

        // don't change these
        private var particlesCurrent:Number = 0;
        private var particlesArray:Array;      
        private var radians:Number;
        private var _sayac:uint;

        public function Main():void

        private function init():void
            radians = 180 / Math.PI;
            particlesArray = [];

            addEventListener(Event.ENTER_FRAME, onEnterFrameLoop);

            dispenser_mc.addEventListener(MouseEvent.MOUSE_DOWN, onThingDown);
            puller_mc.addEventListener(MouseEvent.MOUSE_DOWN, onThingDown);

            dispenser_mc.addEventListener(MouseEvent.MOUSE_UP, onThingUp);
            puller_mc.addEventListener(MouseEvent.MOUSE_UP, onThingUp);


        private function onThingDown(event:MouseEvent):void
        private function onThingUp(event:MouseEvent):void

        private function createParticle(target1:MovieClip, target2:MovieClip):void
            if(particlesTotal <= particlesCurrent)

            var tempParticle:Particle = new Particle();

            tempParticle.x = (target1.x - target1.width / 2) + (Math.random() * target1.width);
            tempParticle.y = (target1.y - target1.height / 2) + (Math.random() * target1.height);
            tempParticle.rotation = Math.random()*360;

            tempParticle.rot = Math.atan2(target1.y - target2.y, target1.x - target2.x);
            tempParticle.xSpeed = Math.cos(tempParticle.rot) * radians / particleSpeed;
            tempParticle.ySpeed = Math.sin(tempParticle.rot) * radians / particleSpeed;
            tempParticle.mass = tempParticle.width / 2 + tempParticle.height / 2;




        private function updateParticle():void
            for (var i = 0; i < particlesArray.length; i++)
                var tempParticle:MovieClip = particlesArray[i];

                tempParticle.x -= tempParticle.xSpeed;
                tempParticle.y -= tempParticle.ySpeed;  
                tempParticle.alpha -= particleFadeoutSpeed;
                // I know i can set boundries here but idk how to so :)

                else if (tempParticle.alpha <= 0)
                else if (tempParticle.x < 0)
                else if (tempParticle.x > stage.stageWidth)
                else if (tempParticle.y < 0)
                else if (tempParticle.y > stage.stageHeight)

        private function destroyParticle(particle:MovieClip):void
            for (var i = 0; i < particlesArray.length; i++)
                var tempParticle:MovieClip = particlesArray[i];
                if (tempParticle == particle)

        private function onEnterFrameLoop(event:Event):void
            createParticle(dispenser_mc, puller_mc);


Sort object by another object value inside

Here some complication sorting in my application.

Now i have data object is like following(called pCList):

  Id: 1
  comp: Test
  med: xyz
  condition: valueObject.Condition

  Id: 2
  comp: Test1
  med: pqr
  condition: valueObject.Condition

  Id: 3
  comp: Test
  med: abc
  condition: valueObject.Condition

condition VO Have data like:

condition data1:
  conId: 001
  cond: abcds

condition data2:
  conId: 001
  cond: trdfd  

condition data3:
  conId: 001
  cond:  dsdsds

For normal sorting i will do as following way;

var sort:ISort = new Sort();
var sortField:ISortField = new SortField("med");
sort.fields = [sortField];

if(pCList != null)
    pCList.sort = sort;

In which pcList is sort by med.

But now, I want to sort by condition.cond
like first come which have cond value abcds then dsdsds then trdfd and so on...

I Have tried it using:

var sort:ISort = new Sort();
var sortField:ISortField = new SortField("condition.cond");
sort.fields = [sortField];

But not succeed. Any help is greatly appreciated.

Flex - Clearing DateField value on tab change in TabNavigator

I have the following tab navigator, which has a Project tab, containing a Combobox next to Release label as follows(AdditionalDetails.mxml): enter image description here

Same tab navigator is having a Gate2 tab, which contains a DateField next to the label CERT load date, which can be seen below(Gate2.mxml): enter image description here

Now, when I select Release as TBD on Project tab, an alert box appears as follows: enter image description here

On clicking YES, I want to clear the DateField on Gate2 tab. How can I do so? Code for Combobox(AdditionalDetails.mxml):

<mx:ComboBox id="General_Release_Dates"
                     valueCommit="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}"
                     change="{model.General_Release_Dates = event.currentTarget.selectedItem;updateReleaseDate(event)}" close="closeHandler(event);" includeInLayout="true" visible="true">

Code for handling YES click on Alert box:

private function alertClickHandler(evt:CloseEvent):void {
if (evt.detail == Alert.YES) { //Code to clear DateField}

DateField code on Gate2 tab(Gate2.mxml): DateField code:<mx:DateField id="G2_CRTLoadDate" width="150" selectedDate="{modelProxy.G2_CRTLoadDate}" change="{modelProxy.G2_CRTLoadDate = event.currentTarget.selectedDate;changeManagerStatus()}"/>

RSS Reader compiling but not displaying

My data is parsing xml fine and compiling, however it is not displaying anything. The two boxes ('lb' - listbox and 'ta') are components - i'm not sure if this has anything to do with its failure to display. Not entirely sure how to go about this.

(concept: box on left hand side should display listed xml recipes using a list component, when clicked the feed should be displayed on the right box, which is a dynamic text area).

//create an event listener for the listbox, to change data when recipe is selected

lb.addEventListener(Event.CHANGE, itemChange);

//function to change data accordingly

function itemChange(e:Event):void
  //textbox data to change to selected item in listbox
  ta.text =;

//create a loader to listen for completion upon loading XML function

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);

//declare xml variable
var xml:XML;

//function for event onLoaded
function onLoaded(e:Event):void

 trace("successfully loaded");
 /*consider  the itemlist as an array, enabling pinpointing data
 through the XML channel (such as description, title etc) to extract
 the data I want to display.*/

 xml = new XML(;
 var il:XMLList =;

/*create a for loop to add data (in this instance the description text
from the channel of the XML file and also to take the title text from 
the XML and display it in the listbox to convey content.*/

for(var i:uint=0; i<il.length(); i++)


//load the XML file from a URLRequest to the following website.
loader.load(new URLRequest(""));

the xml file appears to be way too large/not letting me copy+paste, but it can be found via

Thanks in advance!

dimanche 30 août 2015

Why are my numeric stepper values so far out past the decimal point?

I'm using the Flex 4.6 Spark Numeric Stepper in my app and when I enter .9 it returns, "0.9000000953674316". I can enter any value actually. It is doing it for all of them.

If I use the arrow buttons it moves from 0 to 1 it sets the value to "0.09999990463256836".

Position one object based on another that's rotated

I have a set of blocks which could be rotated at any angle. My task is to create an extra block to one side of the set, adjacent to the last block. I'm using Flex/AS3 and openscales. An illustration will be good to explain what I want to achieve. I apologise in advance for the crudeness of my pictures, I only have MS Paint to hand!

Easy extra block

Wrong block

Corre2t block

My current formula for the picture 2 is simply:

block5XPos += block4XPos - block3XPos;
block5YPos += block4YPos - block3YPos;

** Edit **

I cannot work with Display Objects in the usual way i.e. rotate, addChild. I'm restricted to utilising x and y values and having to re-calculate these values.

Java heap space,AIR 18

i working on an IOS application,using flashedevelop and AIR sdk version 18, i got the Java heap space error while compiling the project.

here is what i have try: 1,modify the jvm.config, ok,i have not try this,because there is not such file in air sdk 2,modify the adt.bat file,-Xms1024 -Xmx1024,i tried,not working 3,modify the mxmlc.bat,like adt.bat,not working

any solution?

any idea will be greatful!

and,plz don't adivce me to divide the resouce and code.i can not

How would you secure data in your AIR application?

My client wants to store his login in the Adobe AIR application. Is this a good idea? I've looked at using Encrypted Local Storage (which uses the operating system) or is there another method more suitable?

I've found this answer but it is very confusing, It is saying it is OK to use to store login information but not OK to store registration keys for licensing software. I don't understand that. Login is more important than registration keys.

How do I setup an SFTP connection in my AIR application?

How do I setup a SFTP connection in my Adobe AIR application? I would like to add uploading and I don't think FTP is secure as it is.

How to package CocoaPods dependencies in ANE

I'm trying to create an iOS GoogleMaps ANE, but i'm having troubles with the resulting packaged ANE.

I'm able to successfully create the ANE, but when i try to create an IPA using the resulting ANE, i get a "Id: file was built for unsupported file format" error:

enter image description here

In order to use GoogleMaps in objective-c, a CocoaPod dependency must be downloaded, so this must be a packaging problem.

The question is, What is the correct way to package a CocoaPod in an ANE?

My current platformOtions.xml contains the following code:

<platform xmlns=""> 

    <option>-rpath @executable_path/Frameworks</option>

This the ANE package: enter image description here

Hope someone can help me.

Why isn't my exception being caught?

This is the stack trace I get:

[Fault] exception, information=Error: Directory id 3 already in use
at cantrips.assets.index::AssetIndex/dirIdChanged()[/home/luismasuelli/Proyectos/flash-assets-index-ritual/assets-index-loader/src/cantrips/assets/index/]
at cantrips.assets.index::AssetDirectory/set id()[/home/luismasuelli/Proyectos/flash-assets-index-ritual/assets-index-loader/src/cantrips/assets/index/]
at Main/updateSelectedDirectory()[/home/luismasuelli/Proyectos/flash-assets-index-ritual/assets-index-editor/src/Main.mxml:192]
at Main/__dirUpdateCurrent_click()[/home/luismasuelli/Proyectos/flash-assets-index-ritual/assets-index-editor/src/Main.mxml:401]

This is the implementation of Main/updateSelectedDirectory():

    private function updateSelectedDirectory():void {
        try {
            var newId:uint = uint(dirId.text);
            var newName:String = StringUtil.trim(dirName.text);
            var selectedDirectory:AssetDirectory = assetBrowserTree.selectedItem as AssetDirectory;
            if (selectedDirectory) {
       = newId;
       = newName;
                assetBrowserTree.expandItem(selectedDirectory.parent, false);
                assetBrowserTree.expandItem(selectedDirectory.parent, true);
        } catch (error:Error) {
  , "Cannot update");

Why is not the exception being caught by try {} catch(error:Error) {}?.

The exception is an exception created by me, with a well-understood scenario where it is triggered (I created the exception and designed those scenarios and I am testing them; exception is triggered as I expect). I also tried using the exact name of the exception (AssetIndexError) in the catch block, and no confusion or ambiguous name exists (this means: there's no another AssetIndexError class declared elsewhere I could be importing instead of this).


  • cantrips.assets.index is code I have control over.
  • Main/* is the main window. I also have control over that code.



Cannot push past 1 element to basic AS3 Array

I am very new to this and hoping it's something that should have been obvious.

When I run the code below, the Array newHole and newArray both return 1 on the trace. Originally the code was built with only the newHole array, but I created the newArray in the hopes of troubleshooting. It did not help. The class for bulletHole contains no extra code so I didn't post that.

Thank you.

import flash.display.*;
import flash.ui.Mouse;


var myReticle:MovieClip;
var holeArray:Array = new Array();
var randomHole:Number = randomNumber(1, 5);
var newHole:bulletHole = new bulletHole();
var newArray:Array = new Array();

stage.addEventListener(MouseEvent.MOUSE_MOVE, followReticle);
stage.addEventListener(MouseEvent.CLICK, myFire);
stage.addEventListener(MouseEvent.CLICK, checkCount);

function followReticle(event:MouseEvent):void
    myReticle.x = mouseX;
    myReticle.y = mouseY;

function myFire(int):void
    newHole.x = myReticle.x;
    newHole.y = myReticle.y;

function checkCount(int):void

function randomNumber(low:Number=0, high:Number=1):Number
    return Math.floor(Math.random() * (1+high-low)) + low;

Is there a difference between MovieClip(X) and X as Movieclip?

Maybe in performance.
I'm constantly using MovieClip(getChildByName("x")).stop();
Is it better than (getChildByName("x") as MovieClip).stop(); ?

Flash AS3 | Finishing current animation set before code is executed

I'm trying to solve a problem I have in Flash CC AS3 regarding button usage. I'll try and make this as easy to explain as I can.

I currently have two sets of frames that have motion in them: one of a man walking slowly (frames 1-30) and the next is the same man but walking much faster (frames 31-60). For both sets of animations, the start and end frames are exactly the same, so a seamless transition can be enabled if the transition happens at the end point of the currently viewed animation.

The sets work by themselves by simply playing from their start frame till the end frame, where AS code makes them stop and then jump back to the original start point and repeat, on endless loop. I have a button that, when pushed, jumps to the start point of the next animation, where the new animation is now played. EG the man is walking, I press the button, now the man is walking faster.

The problem is that when I push the button, the animation instantly changes from whatever frame you are currently on to the new start point, and this creates a 'cut' effect which looks awful because of the skipped frames. How would I be able to make it so that when the button is pushed, the remaining frames finish playing before jumping to the new animation? IE The man is mid walk at the 17th frame, and the user pushes the button. The animation plays out to the 30th frame before jumping over to play the 31st frame of the new loop.

I've tried toying around with an if statement, but I can't find the proper commands to solve this issue. Any help would be much appreciated

TL;DR Once resolved, the animation should perform as follows: Frames 1-30 are playing in a seamless loop. When I press a button, the animation will continue to play until Frame 30, where it will then begin to play Frames 31-60 in a loop.

Any help would be much appreciated!

Why the movie clip is not visible at start

I'm trying to make a soap bubble game in flash as3 and i have the following code but the ball is not visible at start.I programmed it to set the ball's position at start to a specific x,y but it looks like it hits the obstacles before it sets to that position Any help would be apreciated. Thanks in advance.


var accelX:Number;
var accelY:Number;

var fl_Accelerometer:Accelerometer = new Accelerometer();
function fl_AccelerometerUpdateHandler(event:AccelerometerEvent):void
accelX = event.accelerationX;
accelY = event.accelerationY;
ball.addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(evt:Event){
ball.x -= accelX*30;
ball.y += accelY*30;

if(ball.x > (800-ball.width/2)){
    ball.x = 800-ball.width/2;
if(ball.x < (0+ball.width/2)){
    ball.x = 0+ball.width/2;
if(ball.y > (480-ball.width/2)){
   ball.y = 480-ball.width/2;
if(ball.y < (0+ball.width/2)){

 this.addEventListener(Event.ENTER_FRAME, handleCollision);
function handleCollision(e:Event):void
    ball.visible = false;
    ball.visible = true;

The games created for Android in Adobe flash are crashing without giving an error on the device

I am building a simple game in flash for android. I am using AS3. After publishing the APK and trying it on the device the game crashes automatically. and it doesn't even use a lot of resources. i tried everything but still the same problem.

I also tried publishing the apk with and without the Adobe Air Embeded. Can Anyone tell me why is this happening?

And i am using accelerometer. And the Frame rate is 24. Device is Redmi note 4g.

Seperate Items in CombBox

I currently have the below code. I am getting results with my combo box displaying the names, however the names are all displayed in one box next to each other, not as separate items.


var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, loadXML);

var xmlData:XML = new XML();

function loadXML(event:Event):void {

    xmlData = new XML(;

    for each(var categoryTitle:String in xmlData.categories) {
        cb1.addItem( {label:xmlData.categories.category.attribute("name")} );


xmlLoader.load(new URLRequest("_scripts/clipart.xml"));

This is my XML file layout:

        <category name="Superheroes">
                <name>Captain America</name>
                <name>The Flash</name>
        <category name="Movies">
        <category name="Christmas">
        <category name="Halloween">

I am aiming to display each as an individual item, as I am then going to have a TileList display the images in that selected category.

Any help would be great! Thanks in advance!!!

RegExp of flex and actionscript project in flash builder

For the same code below:

trace(new RegExp("..")("Hello"));

In ActionScript Project output:


But in Flex Project output:



samedi 29 août 2015

Set Linakge name through actionscript3

How can I set Linkage name to MovieClip through AS?

I want to duplicate movieClip without setting linkage name in library panel.

How do I import a flat file with a form I drew myself into a flash builder project? [on hold]

I am relatively new to programming, I have learned some HTML, CSS, javascript and run tomcat server to host my own websites. All of these tools work beautifully. Recently, I have decided to have some live streaming on my pages then I started to use red5 to do so since buying flash server consts and arm an a leg. Adobe has lots of products with lots of features that are not very useful.It's like buying a nice house and paying three times the cost of it just because it comes with a dog, kids, a wife etc, all of which I don't want because I can get it myself. I am creating my first flash apps and stuff. I got flash pro and flash builder, then I see this laughable method for creating animations, buttons etc...which is ridiculous. So I am like WHAT??? I buy an expensive product which allows me to draw circles and rectangles so that I can animate it with a script language adobe exclusively uses? WHAT THE HELL DID I BUY THIS FOR? you can do awesome things using css and javascript, php, angular etc!!!. To top it off, I went online to find some documentation on AS3 and I am like, screw these freaking small letters all unorganized that just gave me a headache !! WHY adobe didn't use their awesome tools to create a beautiful website to store and display all the documentation? OH! they decided just to copy it and paste it between two html tags!!. I don't know if I am the only one feeling this way, maybe it is just I am too young for all this.

Show native view and control on an IOS ANE

I'm on my first endeavor of creating an ANE. The final result should be an iOS GoogleMaps ANE.

However, i'm not able to find enough documentation on how to show native controls or views, on top of the Air Stage.

I found the following post, but it only shows some code and i'm not sure if UIApplication is defined, since the xcode project is a static library project.

Access ViewController in iOS-Native Extension for Adobe Air

Can anyone give me some help.

Best reagrds, Carlos.

AS3 + Starling - Find Unknown Sprite

I have legacy code project. While Starling is running sometimes some Sprite appears and covers all application.

In pure flash I used "console" to get object hierarhy in display tree. But it doesn`t work for Starling.

My idea is to add some listener to root, cause this Sprite is in display list tree. And find who is this Spite's parent. Is it possible?

Create a copy of existing movieclip in AS3

I have a library movieclip: Cards. On Cards every frame is a card (vector) (e.g. frame 1: club Ace, frame 2: club 2, etc). I created a new instance of Cards and converted every frame to bitmap (so now club Ace on frame 1 is a bitmap), and now I want every card (that I will add) on the stage to be a copy of converted object.

var cachedCard:Cards = new Cards();
// [...] for every frame convert that frame to bitmap, remove original children and add bitmap instead
var newCard:MovieClip = new MovieClip();
newCard = cachedCard; 
// I understand that this is not working, 
// a similar example would be with arrays, array1 = array2, 
// array1 is just another name for array2, 
// but you can use array1.concat(array2) and now array1 is separated from array2 
// Can I do something similar with movieclips ?!

I already tried this solutions: AS3 clone MovieClip

I tried this:

function copyClip( clip:MovieClip )
    var sourceClass:Class = Object(clip).constructor;
    var duplicate:MovieClip = new sourceClass();
    return duplicate;

var card:MovieClip = new MovieClip();
card = copyClip(cachedCard);

but it creates a new instance of original Cards, not the one with bitmaps in it.

How do I use the modified Cards movieclip (the one with bitmaps) to assign it to every new card I add to stage?

Any help will be appreciated. Thanks

How do you get the namespace of a component?

I'm trying to write CSS stylesheet dynamically but Flex 4 requires that you declare the namespace in the Style markup.

If I have a Spark Button or MX Button class or class instance how would I get the namespace of that button?

So far I've tried this:

var className:Object = getQualifiedClassName(myButton);
var ButtonClass:Object = ApplicationDomain.currentDomain.getDefinition(className);
var button:Object = new ButtonClass();

With that information I can write this:


    myButton {
        color: red;


I need to create this:

    @namespace s "library://";
    @namespace mx "library://";

    s|Button {
        color: red;


Change Date Format in AS3

I've got this basic code :

var currentDate:Date = new Date()
   var tommorow:Date = new Date()
   var day3:Date = new Date()
   var day4:Date = new Date()


If I do :


it returns : Tue Sep 1 18:16:12 GMT+1100 2015

How can I format this date in order to return this : "Tuesday 1 september 2015" ?


MouseEvent.CLICK in transparent area

I have a movieClip that i want to get mouse click event on it, it works fine but it doesn't fire this event when i click on transparent area. is there any solution except to define a rectangle as hitArea?

mc.addEventListener(MouseEvent.CLICK, onMouseClickEvent);

function onMouseClickEvent(event:Event) {

    trace("on clicked");

vendredi 28 août 2015

AS3 Execute Javascript with HTML.Location

I want to execute Javascriptcode by calling HTML.location e.g.

HTML.location = "javascript:alert("test");";

I know that I can do that with NavigateToUrl(, "_self"), but I need to do it with HTML.

Info link:

I hope someone has a workaround for this.

Thanks in advance

Identify Certain Text Within Input Text Actionscript 3.0

Ok, hi there. Just have a quick question to ask. In basic terms, I'm trying to develop a TextEditor in Flash and Actionscript and What I'm trying to do for example is identify whether "addEventListener" has been typed into my input field. From there I want to change the colour of the area that says "addEventListener" to say for example, blue.

So I was just wondering what is the most basic way to do this

as3 input text on ipad

When on i-pad the user clicks on the input text the cursor goes below the sprite where the input text lives.

Once they are finished typing the input text goes where it is supposed. Has anyone encountered this issue?

Call a random function from an array

I have three functions that I have listed in an array. Now I need a random function of the three to be called when pressing a button. However, when I press the button it calls all three functions and I'm not quite sure where I've gone wrong. It looks like this right now:

function Arm1function1(){
this.parent.parent.parent.Armfront1.visible = true;
this.parent.parent.parent.Armback1.visible = false;

function Arm1function2(){
this.parent.parent.parent.Armfront1.visible = false;
this.parent.parent.parent.Armback1.visible = true;

function Arm1function3(){
this.parent.parent.parent.Armfront1.visible = false;
this.parent.parent.parent.Armback1.visible = false;

function getRandomElementOf(Armbuttonarray1:Array):Object {
var Armbuttonarray1:Array = [Arm1function1(), Arm1function2(), Arm1function3()];
var idx:int=Math.floor(Math.random() * Armbuttonarray1.length);
return Armbuttonarray1[idx];

Randombutton1part1.addEventListener(MouseEvent.CLICK, Randombutton1part1Click);
function Randombutton1part1Click(e:MouseEvent):void


Any clue of where I've gone wrong?

AS3 | FPS issue while running on browser

I've built a small game that running perfectly while on local (from Flash). It's a small 60-fps game. Using the same computer, I'm playing the swf using a browser (Chrome, Firefox, Explorer) however it's running extremely slow. I'm using swf monitor (and Browser monitor) there you can see clearly the swf is running with 61/60 fps however this is just not true. Seem like the browser is forcing swf fps down to around the 20 fps or so. I've also tried Wmode (direct / GPU) but nothing. What is going on?

Encrypt String into Numbers

When I was modifying a swf loader i found a encryption. where -1820302713 means "addedToStage", I found this using trace method.

Can anyone tell me how to do this.

AS3 - Adding new instances of a Class with Spacebar

I have 2 classes, Main and Rocket, and I am trying to create a new instance of Rocket every time I hit the space bar. Here is what I have right now:
   //Some of the code is cut off, i brought only the relevant parts

    public class Main extends MovieClip {
    private var rocket:Rocket = new Rocket();

    private function enterFrameHandler(event:Event):void

        if (_pressingSpace)
            rocket.x = _player.x; 
            addChild(rocket); //Rocket image added to player's x only


    import flash.display.Bitmap;
    import flash.display.Sprite;

    public class Rocket extends Sprite

        [Embed(source = "red_dot.gif")] public static var pictureClass:Class;      // save image to class

        private var myBitmap:Bitmap = new pictureClass; // create bitmap data

        public function Rocket() 
            addChild(myBitmap); // add the bitmap



So right now, when I press the space bar the class with the bitmap is added to the screen with addChild, and the x of that image is the same as player's x(I have a player that can move). Next time I click the spacebar(without releasing space), It just follows me around to wherever I go with my player. what I want to do is, to add a new image rocket every time I click the space bar to wherever my player's x is. Btw later on I wanna be able to manipulate each of these newly created images, so put it also into consideration please. Thank you.

VerifyError: Error #1014: Class flash.display::PNGEncoderOptions could not be found

I'm getting errors in my AIR application saying that it can't find the PNGEncoderOptions class. I have a reference and even declare an instance in the main application. But at runtime I get the following error:

VerifyError: Error #1014: Class flash.display::PNGEncoderOptions could not be found.

Here is my code in application complete:

var options:PNGEncoderOptions = new PNGEncoderOptions();
var hasJPEGEncoderOptions:Boolean = ApplicationDomain.currentDomain.hasDefinition("flash.display.JPEGEncoderOptions");
var hasPNGEncoderOptions:Boolean = ApplicationDomain.currentDomain.hasDefinition("flash.display.PNGEncoderOptions");

I'm using Flash Builder 4.7.
I'm using SDK /Applications/Adobe Flash Builder 4.7/sdks/4.6.0 AIR 3.6.

Looks like others have had the issue unsolved too.

How to run JavaScript dynamically in a Flex AIR application?

What is the easiest way I can run JavaScript dynamically in a Flex or ActionScript AIR application?

This is what I have so far. It does not work yet and htmlComponent.domWindow is so far null:

            if (htmlComponent==null) {
                htmlComponent = new HTML();
                htmlComponent.htmlText = "<html><script>"+myJavaScript+"</script><body></body></html>";
                htmlComponent.addEventListener("complete", function(e:Event):void {trace('html load complete');});

            if (htmlComponent.domWindow && htmlComponent.domWindow.validateXML) {
                result = htmlComponent.domWindow.validateXML(value);
                validationInfo = parseValidationResult(result, value);

Can we write a script to connect to Remote desktop and copy some files to there?

I would like to write a script to copy some files to remote desktop My system is MAC and remote desktop is windows.

May I know is it possible or not, if so, which scripting language is best to use.

Thanks in Advance, Swathi.

Flex As3 Line Chart Grouping on Axis

enter image description here

I want to show these type of large scale data using flex line chart component on device, I have some filter like past week, past month and past 3 months

all have some/large amount of data

{ Date: "1/1/2015", Day:"Sunday" , DayAbv:"SUN", Severity: 2 },

{ Date: "1/2/2015", Day:"Monday" , DayAbv:"MON", Severity: 5},

{ Date: "1/3/2015", Day:"Tuesday" , DayAbv:"TUE", Severity: 4},

{ Date: "1/4/2015", Day:"Wednesday" , DayAbv:"WED", Severity: 7},

{ Date: "1/5/2015", Day:"Thursday" , DayAbv:"THU", Severity: 5},

{ Date: "1/6/2015", Day:"Friday" , DayAbv:"FRI", Severity: 7},

{ Date: "1/7/2015", Day:"Saturday" , DayAbv:"SAT", Severity: 4}

Same as past month and past 3 months data in series

How can i group the Dates as per below image ? On y axis value would be same but on x axis dates should be in grouping.

In second line chart I have these type of data

{ Time: "08:10",  Average: 1 , Date : "1/1/2015" , Appearance : "Yes" },

{ Time: "09:25",  Average: 1 , Date : "1/1/2015" , Appearance : "Yes" },

{ Time: "11:20",  Average: 0 , Date : "1/2/2015" , Appearance : "No" },

{ Time: "13:20",  Average: 0 , Date : "1/3/2015" , Appearance : "No" },

{ Time: "15:55",  Average: 1 , Date : "1/3/2015" , Appearance : "Yes" },

{ Time: "18:05",  Average: 0 , Date : "1/5/2015" , Appearance : "No" },

{ Time: "20:30",  Average: 1 , Date : "1/5/2015" , Appearance : "Yes" }

In Detail, I want to show Week1 only on X axis and in week1 all the above point for Past week data, and for past month week1,week2,week3,week4 like so on.
On one axis multiple plotting

jeudi 27 août 2015

How to get the parent array indside the filter [Flex]?

I have the code as following

var ar:Array = ["Joe","Bob","Curl","Curl"];
var distinctData = ar.filter(function(itm, i){
    return ar.indexOf(itm)== i; 

The question is how can I get the parent array ar inside the filter function? I tried this keyword but it wasn't working.

Why am i getting a syntax error in flash?

Below is my actionscript code for flash, but im getting an syntax error on line 65, any ideas why? The code is for a game called escape the room, where the player must find objects to move on and open the door. When i run the flash movie it keeps flashing and i cant drag anything, which im meant to be able too because thats what the code is about.


inventorykey_mc.alpha = 0;
inventorypotion_mc.alpha = 0;
inventoryswipecard_mc.alpha = 0;

key_mc.addEventListener(MouseEvent.MOUSE_DOWN, objectFound);
potion_mc.addEventListener(MouseEvent.MOUSE_DOWN, objectFound);
swipecard_mc.addEventListener(MouseEvent.MOUSE_DOWN, objectFound);

var founditems:Number=0;

function pickupObject(event:MouseEvent):void {;

function dropObject(event:MouseEvent):void {;

crate1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
crate1_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

crate2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
crate2_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

crate3_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
crate3_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

crate4_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
crate4_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

drum1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
drum1_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

drum2_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
drum2_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

drum3_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
drum3_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

bin1_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickupObject); 
bin1_mc.addEventListener(MouseEvent.MOUSE_UP, dropObject); 

function escapeRoom(event:MouseEvent):void {

function objectFound(event:MouseEvent):void {
    var inventoryName:String = "inventory" +; 
    var inventoryItem:DisplayObject = getChildByName(inventoryName); = inventoryItem.alpha = 100; 
    founditems ++; = 0; 
    *if(founditems = = 3){* 
        door_btn.addEventListener(MouseEvent.MOUSE_DOWN, escapeRoom);

Can I do this in Swift/Java?

I'm porting an app made in as3, where I have this:


is it doable?.

Also I need to do this, creating objects this way:

var myKlassObject:Klass = getDefinitionByName( "Klass" ) as Class;

or this way:

private function createClass(classType:Class):void {

    var component:Object = new classType();


are there similar methods in Swift and/or Java?.

AS3 Sending a Shared Object

I'm working on an application that would allow users to create a custom character sheet for role play games. I have most of the code figured out, but I want users to be able to send their character sheets between devices.

So here's the question: is there a way to save and send a shared object file, or a way to create a txt file that can easily be saved and copied?

How do I get access to assets added to a library?

I have a main project and an external library. I want to add assets to the external library in src/assets/[10 files here].

I can go into the external library properties and manually select these files to include as shown (1 file selected):
enter image description here

In my main application I want to access them. How do I do that?

Note: I may update these files periodically, copying the files and pasting them into that directory. There may be a few more or less files each time. So I'm against embedding them.

ActionScript3 remove child error

I recently have been converting an as2 fla to as3 (new to AS3) and have the entire thing working on export, but I am getting an error when I try to remove previously loaded swf's before a new swf is loaded

ArgumentError: Error #2025: The supplied DisplayObject
must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at MethodInfo-11()

I know the error relates to my removeChild code here:

`stage.addEventListener(MouseEvent.CLICK, removeSWF);
function removeSWF (e:MouseEvent):void 
if(vBox.numChildren !=0){        
   // swfLoader.unloadAndStop();
    vBox.removeChild(swfLoader);// empty the movieClip memory

However, I cannot seem to find a suitable rewrite for this code that will work and not have an error. This code IS working, so I'm not sure if it would be worth my time to fix this error, or just leave it. I've already messed with it for a couple days, so at this point it's just frustrating me that I cannot fix it. The stage mouse click listener is useful in this case because I have a back button not shown in this code that clears the loaded swf's before moving to another scene. Does anyone see a simple solution for this, or do you think it is unnecessary to pursue since the code does what I require? ENTIRE CODE:

function launchSWF(vBox, vFile):void    {
var swfLoader:Loader = new Loader();
var swfURL:URLRequest = new URLRequest(vFile);
swfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadProdComplete);

function loadProdComplete(e:Event):void {
    trace("swf file loaded");   
    currentSWF = MovieClip(swfLoader.content);
    currentSWF.addEventListener(Event.ENTER_FRAME , checkLastFrame);
    swfLoader.x = 165;
    swfLoader.y = 15;

    function checkLastFrame(e:Event):void { 
        if (currentSWF.currentFrame == currentSWF.totalFrames) {
        // trace("DONE");     
var preLoader:loader = new loader();
preLoader.x = 450;
preLoader.y = 280;

        function onProgressHandler(event:ProgressEvent){
            var dataAmountLoaded:Number=event.bytesLoaded/event.bytesTotal*100;
            // = dataAmountLoaded/100;
            preLoader.lpc.text= int(dataAmountLoaded)+"%";
            //trace( );
stage.addEventListener(MouseEvent.CLICK, removeSWF);
function removeSWF (e:MouseEvent):void 
if(vBox.numChildren !=0){        
   // swfLoader.unloadAndStop();
    vBox.removeChild(swfLoader);// empty the movieClip memory
var container:MovieClip = new MovieClip();
var currentSWF:MovieClip = new MovieClip();

fall_b.addEventListener(MouseEvent.CLICK, fall_bClick);
  function fall_bClick(e:MouseEvent):void {
  var swfFile:String = 'load/fall.swf';
  launchSWF(container, swfFile);

face_b.addEventListener(MouseEvent.CLICK, face_bClick);
  function face_bClick(e:MouseEvent):void {
  var swfFile:String = 'load/face.swf';
  launchSWF(container, swfFile);

rott_b.addEventListener(MouseEvent.CLICK, rott_bClick);
  function rott_bClick(e:MouseEvent):void {
  var swfFile:String = 'load/rottgut.swf';
  launchSWF(container, swfFile);

Any advice anyone has is appreciated

How can I convert XML to XMLList?

I have an XML object and want to convert it to XMLList. Because I'm getting this error:

 TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@7ff5fee1c2f1 to XML.

Here's my code:

GenerateMenu(, xPos, yPos,;

Here's how the property defined:

mc.xmlNode = xml.child(i);

How can I fix this error?

Loading an external image using AS3. Working from debug player, not from within AIR app

I have an SWF ("SWF A") that loads an image and attaches it to the stage. It works fine when ran from the debug player, but not when ran from within an AIR application.

The AIR application loads several SWFs and adds them to the stage. "SWF A" is successfully loaded within the AIR application.

Below is the code I'm using. This is a separate .as, linked to the .fla.

package  {

    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.system.LoaderContext;
    import flash.display.Bitmap;

    public class RemoteAssetLoader extends MovieClip
        protected var urlLoader:Loader;

        public function RemoteAssetLoader():void
            this.logMessage('constructor start');
            this.addEventListener(Event.ADDED, this.init);
            this.logMessage('constructor end');

        protected function logMessage(messageText:String):void
            // this.debug references a 
            this.debug.text = messageText;

        public function onComplete(e:Event):void
                this.logMessage ('onComplete start');
                var image:Bitmap =
                this.logMessage('onComplete end');
            catch (error:Error) {

        public function onGeneral(e:Event)

        public function init (e:Event):void
            try {
                this.logMessage ('init start');

                this.urlLoader = new Loader();

                this.logMessage ('init start 1');

                this.urlLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onGeneral);

                this.logMessage ('init start 2');

                this.urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onComplete);

                this.urlLoader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.onGeneral)
                this.urlLoader.contentLoaderInfo.addEventListener(Event.OPEN, this.onGeneral);
                this.urlLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, this.onGeneral);
                this.urlLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onGeneral);

                this.logMessage ('init start 3');

                var context:LoaderContext = new LoaderContext(); 
                context.checkPolicyFile = true; 

                this.logMessage ('init start 4');

                var url:String ='';

                this.logMessage ('init start 5');

                var urlRequest:URLRequest = new URLRequest(url);

                this.logMessage ('init start 6');

                this.urlLoader.load(urlRequest, context);

                this.logMessage('init end');
            catch (error:Error) {

When loaded from the debug player, an image of an apple is appended to the stage.

When loaded from within the AIR application, the debug text reads "init end".

Is there something missing, perhaps from LoaderContext, that's required for this to work as expected?

Vimeu resume PUT upload issue on air app

i'm working on an adobe air app that use the briliant vimeo upload api. Upload works really fine and that's great !

However, I now try to resume an upload and can't understand why it doesn't work. Could someone help me to understand why ?

Here is my process as proposed in the doc : Code is AS3

verify the upload

var r:URLRequest = new URLRequest(_ticket.upload_link_secure);
r.requestHeaders = [
    new URLRequestHeader("Authorization", "bearer " + TOKEN),
    new URLRequestHeader("Content-Length", "0"),
    new URLRequestHeader("Content-Range", "bytes */*"),
r.contentType = "video/mp4"
r.method = URLRequestMethod.PUT;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, _resumeProgressComplete);

==> the result of the request :
status 308
the range header is bytes=0-474295

resume upload

My video size : 11685783
The size of the ByteArray is send : 6533957
The range header : 5151826-11685783/11685783
The content length : 6533957 (i also tried ByteArray size +1 as shown on the doc)

var r:URLRequest = new URLRequest(_ticket.upload_link_secure);
r.requestHeaders = [
    new URLRequestHeader("Authorization", "bearer " + TOKEN),
    new URLRequestHeader("Content-Length", contentLength),
    new URLRequestHeader("Content-Range", range),
r.contentType = "video/mp4"
r.method = URLRequestMethod.PUT; = ba;
_urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
_urlLoader.addEventListener(Event.COMPLETE, _resumeComplete);
_urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, _resumeHTTPStatus);

Result status of the request is 200

While uploading the missing part of my video i asynchronously send requests to get the progress of the upload

var r:URLRequest = new URLRequest(_ticket.upload_link_secure);
r.requestHeaders = [
    new URLRequestHeader("Authorization", "bearer " + TOKEN),
    new URLRequestHeader("Content-Length", "0"),
    new URLRequestHeader("Content-Range", "bytes */*"),
r.contentType = "video/mp4"
r.method = URLRequestMethod.PUT;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, _uploadProgressComplete);

The results :  

The last verification done, i send want to complete the upload

var r:URLRequest = new URLRequest("" + _ticket.complete_uri);
r.requestHeaders = [
    new URLRequestHeader("Authorization", "bearer " + TOKEN)
r.method = URLRequestMethod.DELETE;
_urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, _completeUploadComplete);
_urlLoader.addEventListener(Event.COMPLETE, _completeUploadCompleteData);

And that's where i recieve a 400 status an the error message below :
{"error":"Your video file is not valid. Either you have uploaded an invalid file format, or your upload is incomplete. Make sure you verify your upload before marking it as complete."}

Is there something wrong on my code, i followed the documentation and...

Thanks in advance for your reply


Collision Detection hitTestObject not working.. ish

Obviously as you can see from this clip below, the Hit and Miss is not corresponding to the actual event on the stage. why? It works only if I give the objects instance name, but not working when using the var name. why?

here's the code:

var gball: SmallGreenBall1_T = new SmallGreenBall1_T();
var bucket: allBuckets = new allBuckets();
this.addEventListener(Event.ENTER_FRAME, handleCollision)
function handleCollision(evt: Event): void {
  if (gball.hitTestObject(bucket)) {
  output_txt.text = "HIT"
  } else {
  output_txt.text = "MISS"
}[Hit and Miss is not corresponding to the actual event on the stage][1]

How to create a loop for caching images by AS3?

I have 100 movieclip on the stage, named ads_box_1 ... ads_box_100.there is another movieclip in each ads_box, named photo_box.I want cache 100 images(1.jpg,2.jpg,...,100.jpg) from server and add them to each ads_box.photo_box.I try some loops to do that,but they didn't work.So what is the solution?this my code:

import flash.filesystem.File;
for (var i:Number=1; i<=5; i++)
    this["ads_box_" + i].photo_box.alpha = 0;
LocalCacheSettings.WORKING_DIRECTORY = File.applicationStorageDirectory;
//how to create a loop frome here...
var pic_loader:Loader;
NetClassFactory.initialize( LocalCacheLoader, LocalCacheURLLoader, LocalCacheNetStream );
pic_loader = NetClassFactory.createLoader();
pic_loader.contentLoaderInfo.addEventListener( Event.COMPLETE, _onComplete );
var pic_string:String = "http://localhost/Pics/" + String(1) + ".jpg";
pic_loader.load( new URLRequest(pic_string));
function _onComplete(e:Event):void
    var new_pic_mc:Sprite= new Sprite();
    new_pic_mc.width = new_pic_mc.height = 90;
    this["ads_box_" + 1].photo_box.addChild(new_pic_mc);
    this["ads_box_" + 1].photo_box.alpha = 1;
//to here

How can I find Nth element of an xml object

I'm trying to get sub elements of elements of an xml file. I tried using nested loops such as:

for each (var tempNode:XML in menu_xml.elements())
    if (tempNode.children().length() > 0)

however couldn't accomplish that. Even if this this code works it will get elements for limited stages.

How can I get sub elements one by one, or is there a simpler way to do this?

EDIT: Here's the sample xml content:







EDIT 2: I havent decided how to use these nodes. Say I'll parse them to an array. arr[3][0][0] should be joe.

Looping through 8 characters

How could I loop through all possible rearrangement combinations of these 8 characters? LLLMMRRR I need it to be output with trace command and numbered if possible.

Trying to put a flash project for i-pad but on itunes it comes up as an i-phone app

I am making an i-pad app in flash as3. I have all the certificates and am able to upload it to i-tunes, however it is coming up under i-phone apps not i-pad apps and when i download it onto my i-pad it is i-phone size. I have been told that the solution to this should sit in the xml document but even after a lot of searching the web I cannot find how to edit the doc. Here is the entire xml doc if anyone has any ideas

<?xml version="1.0" encoding="utf-8" ?> 
<application xmlns="">


<name>Whiskey for i-pad</name>


        <manifest android:installLocation="auto">
          <uses-sdk android:minSdkVersion="8"/>
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>



            <!-- iPhone support -->
            <!-- iPad support -->


    <title>Whiskey for i-pad</title>
    <!--<depthAndStencil>true</depthAndStencil>--> <!-- required for 3D -->


AIR options:

AIR mobile options:

iOS icons guidelines:

Android manifest documentation:

AIR app:How to load swf from server

My app structure is below:

Login.swf -> Main.swf (OK!)
Main.swf -> assets1&2.swf (fail!, downloaded but not trigger complete event)
-progress event: bytes:loaded==total

How can i load assets from server using Main.swf?
I found somebody say it is crossdomain problem...then how to solve?

var _loader:Loader = new Loader();
var context:LoaderContext = new LoaderContext();
context.allowCodeImport = true;

_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete_handler);
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loader_progress_handler);


AS3 Timer not doing anything in Movieclip Class

I have a document class which loops through some JSON data and adds a "tileMc" on the screen with some information in it. I am needing to do something with one of the text fields inside each of the movieclips but the timer is not responding at all, when i trace nothing is coming up.

In the document class i initialize the tile at the start

public var tileMc: tile;

Then in a function after ive loaded all the json and everything

tileMc = new tile();

                tilePosition += (tileMc.height - 15); //offset between
                tileMc.y = tilePosition;
                tileMc.x = xPos;
                var destName =[i].destinationCity.toString();
       = destName;
       = ([i].airlineCode.toString() +[i].flightNumber.toString());

                var TF: TextFormat =, 1)


this all works perfectly fine as i want it to.

I have then gone into the Tile class so that i can change the destination.text when its too long

package  {

import flash.display.MovieClip;
import flash.utils.Timer;
import flash.text.TextField;

public class tile extends MovieClip {

     public var marqueeTimer:Timer;

    public function tile() {

       trace("TEST 1");
        marqueeTimer = new Timer(0);
        marqueeTimer.addEventListener(TimerEvent.TIMER, onMarqueeTick);


    private function onMarqueeTick(ev:TimerEvent): void

        trace("TEST 2");

    public function marquee(delay:int): void
        if (delay >= 0)
            marqueeTimer.delay = delay;


Only TEST1 is being traced why is the timer not working??

How do I get the messages the HTML control is tracing to the console?

I'm using the mx:HTML control in an AIR app and occasionally there are errors that are traced to the console. For example, here is one of them:

about:blank:3 HTML ERROR: Unmatched </head> encountered.  Ignoring tag.


about:blank:16 HTML ERROR: Extra <body> encountered.  Migrating attributes back to the original <body> element and ignoring the tag.

How can I capture these errors?

AIR/Android - play video from mounted OBB/expansion file

I have about 125MB worth of video files that I need to play from an expansion file (OBB). The OBB file itself is in place and is successfully 'mounted' using a 3rd party native extension, so I can access the files using traditional methods, like the File class, the Loader class, etc.

I use the NetStream and NetConnection classes to play the video file, but the problem is that for the stream to play, the video file needs to be in the same folder as the SWF that is trying to play it (or a subfolder). This is also in the Adobe documentation:

Play a local file

In Flash Player and in AIR content outside the application security sandbox, you can play local video files that are stored in the same directory as the SWF file or in a subdirectory; however, you can't navigate to a higher-level directory.

I tried to play the stream nevertheless, just out of curiosity, and it throws a StreamNotFound error (as because the video file is not in the same folder/subfolder as the SWF). My hunch is that this is some security sandbox thing, and there's a way around it, but I can't find it.

Any help is appreciated.

mercredi 26 août 2015

AS3 - Share a Post with an icon on FB

Picture icon doesn't show up on my post shared on facebook, while caption and description work ok. I am passing picture url directly as string, is that correct?

var params:Object = {   
caption: 'Caption text',
description: 'Description text',
picture: 'https://....../my-image.png' };

activate touch gesture with a php embedded map

I'm creating an AIR app. I've got a map at this address :

the code of this page was on Here it is :

<script type="text/javascript">
    width='100%';       // the width of the embedded map in pixels or percentage
    height='450';       // the height of the embedded map in pixels or percentage
    border='1';     // the width of the border around the map (zero means no border)
    shownames='false';  // to display ship names on the map (true or false)
    latitude='37.4460'; // the latitude of the center of the map, in decimal degrees
    longitude='24.9467';    // the longitude of the center of the map, in decimal degrees
    zoom='9';       // the zoom level of the map (values between 2 and 17)
    maptype='3';        // use 0 for Normal map, 1 for Satellite, 2 for Hybrid, 3 for Terrain
    trackvessel='0';    // MMSI of a vessel (note: vessel will displayed only if within range of the system) - overrides "zoom" option
    fleet='';       // the registered email address of a user-defined fleet (user's default fleet is used)
    remember='false';   // remember or not the last position of the map (true or false)
    language='en';      // the preferred display language
    showmenu=true;      // show or hide the map options menu
<script type="text/javascript" src=""></script>

Now I'm building an AIR app and I would like to make this map accessible by users.

Here's my AS3 code :

import flash.geom.Rectangle;
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
stage.scaleMode = StageScaleMode.EXACT_FIT;

    var webView:StageWebView;
    var swvRect:Rectangle;   
    var swvHeight:Number;  
    var swvY:Number=0;



    function init():void {



         webView=new StageWebView(); 
         webView.viewPort=new Rectangle(0,swvY,stage.stageWidth,swvHeight);

The page is loading perfectly well.

Problem : The touch gesture doesn't work. If I swipe to the left (or any direction) on the embedded map, it's not working.

Do you know how I can make the touch gesture works on this embedded map ?


Flash Actionscript 2 - Redirect to next frame automatically

I am not really newbie for actionscript 2, but i don't know much stuff. I am making simple game with AS2 in Flash CS5.5 and i need to redirect to next/another frame automatically, or after some time (i need automatically). I tried much much much codes...this is last one:

function wait()
stop ();
var myInterval = setInterval(function ()
play ();
}, 120000);
} // End of the function

Doesn't work for me. I changed 120000 to 1 and 0, but still no changes. I placed on frame with red outline and it needs to redirect automatically to frame with green outline. Screenshot: And i placed code to the red frame (as you can see. Is that maybe problem?


ActionScript 3, How to get character to jump for longer

I am making a platformer game in Flash (AS3) and the code I have below works. I want my character to jump high enough to allow it time to reach a platform. The only problem with code below is the speed at which it jumps up and down and the height of the jump. Tthe space bar is what triggers the function to run.

Please help as I would much appreciate it! :)

Player.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_SetKeyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, fl_UnsetKeyPressed);

function fl_MoveInDirectionOfKey(event:Event)
    if (spacePressed){
        var gravity:Number = 9.8;
        var jumping:Boolean = false;
        var jumpVar:Number = 0;

        if(jumping != true)
            jumpVar = -70;
            jumping = true;

            spacePressed = false;
            Player.y += jumpVar;
            jumpVar += gravity;
        Player.addEventListener(Event.ENTER_FRAME, drop);
        function drop(event:Event)
            Player.y -= jumpVar;
            jumpVar -= gravity;
            if(Player.y > 350){
                Player.y = 350;
        Player.removeEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);
        Player.addEventListener(Event.ENTER_FRAME, fl_MoveInDirectionOfKey);

        /*var frameNumb:Number = 0;

        Player.addEventListener(Event.ENTER_FRAME, jumpup);
        spacePressed = false;
        function jumpup(event:Event)
            while(frameNumb < 30){
                spacePressed = false;
                Player.y -= 1;
                frameNumb += 0.5;
            Player.removeEventListener(Event.ENTER_FRAME, jumpup);
            Player.addEventListener(Event.ENTER_FRAME, jumpdown);
            function jumpdown(){
                while(frameNumb > 0){
                    spacePressed = false;
                    Player.y += 1;
                    frameNumb -= 0.5;
    if (leftPressed)
        Player.x -= speed;
    if (rightPressed)
        Player.x += speed;


AS3: getCharBoundaries() returns null

I've been seeing this issue on and off when I use getCharBoundaries() and I'm not quite sure what's causing it. Some text I have is completely okay with it, other times it throws a fit.

Here's my code

while (copy.text.indexOf("{") != -1) //copy is a proprietary textnode type object
    var char:String = "tf"

    var searchString:String = "{" + char + "}";
    var index:int = copy.text.indexOf(searchString);

    var bounds:Object = copy.content.getCharBoundaries(index); //content is a flash textField
    //sprite is created elsewhere, it is not the issue
    sprite.x = copy.x + bounds.x + 4; //here we sometimes get the error that bounds is null
    sprite.y = copy.y + bounds.y - 2;

    //replace the string we used with characters that are easy to hide with the sprite and take up a decent width
    copy.text = copy.text.replace(searchString, "---" ); 

The one that breaks has 2 of the sub-strings we want to remove (called "{tf}". The 2nd one always breaks, even if I remove the first one from the string entirely. The string is not something I can post publicly as it is part of work, but suffice it to say that there are two paragraphs separated by 1 line (that is, two "returns" were typed into it). However, if I remove all of the returns, the 2nd one STILL breaks.

As much as my research has told me, it's just that getCharBoundaries() doesn't like certain characters -- punctuation most of the time -- but 99% of the time when I pass in a string, it works fine. I was hoping someone could possibly explain why getCharBoundaries() returns null (the documentation does not explain this) and what I can do to fix it.

I've tried to get all the indexes BEFORE replacing the string, but i ran into the same issues

TypeError: Error #1009: Null object reference

I understand that it is a null object reference because the object isn't on stage, but I can't seem to correct it. Also, I have the two blocks on either side of the else because I couldn't have it create a variable if = true and the same variable if = False. Would I have to first create it before the if statement then set it in the if statement? Why I am getting a null object reference error?

import flash.display.Stage;

if (stage.stageWidth > stage.stageHeight)
    var Flare21:Flare2Class = new Flare2Class();
    Flare22.x = stage.stageWidth/2
    Flare22.y = stage.stageHeight/2
    Flare21.width = stage.stageHeight
    Flare21.height = stage.stageHeight
} else {
    var Flare22:Flare2Class = new Flare2Class();
    Flare22.x = stage.stageWidth/2
    Flare22.y = stage.stageHeight/2
    Flare22.width = stage.stageWidth
    Flare22.height = stage.stageWidth

Flex Coldfusion variable cross population

I'm connecting a Flex 4.6 form to SQL Server 2008 using Coldfusion. When my form submits to the DB, I'm finding my variables are crossing and I can't seem to see the problem causing it:

Flex Remote Object Call:

 private function RegisterNewEmployee():void{
 //remote object and method instantiated 
 fm_password.text, fm_accessLevel.selectedItem, fm_emailAddress.text, 
 fm_domainField.selectedItem ); }

Flex Components

              <mx:FormItem label="Access Level:" width="182" 
              color="#FFFFFF" required="false">
              <s:DropDownList width="60" color="#FFFFFF"
                id="fm_accessLevel" >
              <s:dataProvider >
                <mx:ArrayList id="accessLevelList">

      <mx:FormItem label="Email: " fontSize="12" width="173"         
      horizontalAlign="left" color="#FFFFFF" required="false">
      <s:TextInput color="#000000" id="fm_emailAddress" 
     <s:Label text="@&#xd;&#xd;&#xd;" fontSize="14" width="15" height="21" 
     <s:ComboBox color="#FFFFFF" id="fm_domainField" height="22" enabled="true">
            <mx:ArrayList id="domainList">

Coldfusion Code:

    <cfargument name="fm_accessLevel" type="any" default="1"> 
    <cfargument name="fm_emailAddress" type="any" default="user01"> 
    <cfargument name="fm_domainField" type="any" 

Problem begins here:

<!--- Concatenate email and domain --->
<cfset emailString = #arguments.fm_emailAddress#&"@"&#arguments.fm_domainField# >

Somehow, the outcome of the concatenation returns the equivalent of

<cfset emailString = #arguments.accessLevel#&"@"&#arguments.emailAddress# >
or **44@MyUserName** in plain text output

Any noticeable issues in the code to cause this? It previously worked without issue. Cache and browser history cleared, issue persists.

PHP parse JSON data from video URLs with ActionScript

I do not get the results I want the following code.

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="" 
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <s:HTTPService id="json" result="getJSON(event)"
                       url="" useProxy="false">
            <s:request xmlns="">

            private var URLRow:String;
            private var URLHd:String;
            private var URLSd:String;

            private var requestedId:String;

            private function getJSON(event:ResultEvent):void{
                if(event.result.count != 0)
                    URLRow = event.result.low;
                    URLHd = event.result.hd;
                    URLSd =;

            private function init(e:FlexEvent=null):void{
                requestedId=data as String;

            private function play_row(e:MouseEvent):void{
                navigateToURL(new URLRequest(URLRow));

            private function play_sd(e:MouseEvent):void{
                navigateToURL(new URLRequest(URLSd));

            private function play_hd(e:MouseEvent):void{
                navigateToURL(new URLRequest(URLHd));

    <s:VGroup left="30" right="30" top="30" height="150">
        <s:Button width="100%" label="Low"  click="play_row(event)"/>
        <s:Button width="100%" label="sd"  click="play_sd(event)"/>
        <s:Button width="100%" label="hd"  click="play_hd(event)"/>

URL address that tries. Working address:

  // $urlJSON = $_GET["id"];

   $json = file_get_contents('');
  // $json = file_get_contents($urlJSON);

   $obj = json_decode($json);
   $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

   foreach($obj->videos as $video){
      if($video->name!="mobile" && $video->name!="lowest"){
            $xml .= "<$video->name>";

            //embed the SQL data in a CDATA element to avoid XML entity issues
            $xml .= "<![CDATA[$video->url]]>"; 

            //and close the element
            $xml .= "</$video->name>";

        //echo $video->name .' :: '. $video->url;
        //echo '<br>';  
   echo $xml;
   echo "<count><![CDATA[$count]]></count>";

[![enter image description here][3]][3] Coming result on this page. However AS3 comes with different results.

AS3 is different cause erroneous URLs? Where did I go wrong?

[AS3]How can I casting AObject to BObject automatically?

I want to cast AObject to BObject automatically like toString(). My original code is below:

var a:AObject = new AObject();
var b:BObject = new BObject();


someFunction(a.toBObject());  // no error
trace(a.toString());          //[object AObject]

So, I want to finish it like toString()

someFunction(a);   //TypeError: Error #1034: Type Coercion failed
trace(a);          //[object AObject]

How can I solve it?

Dynamic text resets instead of retaining current value with multiple buttons AS3

I'm having trouble with this:

Here's a .zip of the Flash file:

I need the 'counter' dynamic text (based on timeline) to show a cumulative total when either of the A or B buttons are clicked.

Currently, buttons A & B are in a movieclip and A takes up the first 50 frames of the clip, then B the next 50.

You'll notice if you access the .swf example, if you immediately click A a few times, then click B when it becomes clickable, the dynamic text does as desired and 'adds' to the total.

However, when the movie clip holding those buttons gets to frame 100, I just let it run back to frame 1 and then, when you click on A again or B again, it resets the total to 1. This is the problem, I need the total to remain wherever it got to, not reset!?

Code in button_container: ('clicked' is the dynamic text name on main timeline)

var clickCount:int = 0;

button_A.addEventListener(MouseEvent.CLICK, addClick);

function addClick(event:MouseEvent):void {

  Object(root).clicked.text = clickCount.toString();


Also, I'd ideally like to have all AS3 on the main timeline somehow. Is this advisable or even the best way to do it? Reason being, e.g. I would eventually like to have 25 x separate 'button_containers' ALL with identical A & B buttons within them and would need to be able to target them all from the main timeline with AS3 and they would again ADD to the 'clicked' total, never resetting it.

Any help would be greatly appreciated, I have spent a long time trying to suss this out and searching this site for solutions with no luck.

ta spumker

Signing a iOS dynamic framework without the team id

We had to use dynamic libraries in an Native Extension for Adobe Air and I found a way to include them in the App. I described my way in the last answer:

I wanted to ask if anybody knows a way how to codesign a .framework (dynamic lib) without the team identifier. The problem that I am trying to solve here is that Adobe Air ipas are signed without the team identifier (for enterprise accounts) and that leads to the problem that I cant use the signed .framework files without re-signing the ipa.

I currently use this command to codesign the frameworks:

codesign --sign "###HASH WHICH YOU GET FROM THE LIST###" --force --all --option=library path/to/your/Framework.framework/

Position one object based on another that's rotated

I have a set of blocks which could be rotated at any angle. My task is to create an extra block to one side of the set, adjacent to the last block. I'm using Flex/AS3 and openscales. An illustration will be good to explain what I want to achieve. I apologise in advance for the crudeness of my pictures, I only have MS Paint to hand!

Easy extra block

Wrong block

Corre2t block

My current formula for the picture 2 is simply:

block5XPos += block4XPos - block3XPos;
block5YPos += block4YPos - block3YPos;

what are all the fields required for logging database table

am a beginner for developing..can you tell me what fields are required to create a table in database for implementing log that what fields comes under master table?

Flex - Problems in accessing static variable on another mxml page

First.mxml - Contains a Datefield control as follows:

<mx:DateField  id="G2_CRTLoadDate" width="150" selectedDate="{modelProxy.G2_CRTLoadDate}" change="{modelProxy.G2_CRTLoadDate = event.currentTarget.selectedDate;changeManagerStatus()}"/>

I'm assigning this Datefield value to a static variable CERT_LOAD_DATE as follows(First.mxml):

public static var CERT_LOAD_DATE:String = "";
private function changeManagerStatus():void
CERT_LOAD_DATE = G2_CRTLoadDate.selectedDate.toDateString();

Second.mxml - When I try to access CERT_LOAD_DATE by writing First.CERT_LOAD_DATE, the compiler won't give any suggestion. How can I access this CERT_LOAD_DATE in my Second.mxml?

mardi 25 août 2015

Interactive movie with facebook photos/infos

I want to create a interactive movie clip just like the famous 'Take this Lollipop' where the user logs in with his facebook and some photos and info appears during the Movie. Is it possible and easy to make this with html5 and javascript, that are the technologies that I'm more familiar? What libraries should I use? If it's better to do this with Flash as3, then how do I start?

I have already googled some tutorials but with no luck.

AS3: New instances of my symbol are overwriting properties of previous instances

So Im working on a project in Flash and I'm having a very strange issue.

The second frame in my project has a series of Actions on it that create multiple copies of a symbol which I've named MessageAction in an array of MessageActions. For some reason, if I create multiple MessageActions, all of the MessageActions on the stage will take on the properties of the most recently made MessageAction, and will act as duplicates of that instance so that anything I do to that instance will also be done to them as well. Specifically I have an OnClick event which "selects" the Message Action, and no matter which one I click, all of them will become selected because they are all mirroring the final one I made.

The code I'm using to create the MessageActions is:

var ActionArray:Array = new Array();

ActionArray[0] = new MessageAction(0);
ActionArray[0].x = 73;
ActionArray[0].y = 565;

ActionArray[1] = new MessageAction(1);
ActionArray[1].x = 73;
ActionArray[1].y = 615;

ActionArray[2] = new MessageAction(2);
ActionArray[2].x = 73;
ActionArray[2].y = 665;

ActionArray[3] = new MessageAction(3);
ActionArray[3].x = 533;
ActionArray[3].y = 565;

ActionArray[4] = new MessageAction(4);
ActionArray[4].x = 533;
ActionArray[4].y = 615;

ActionArray[5] = new MessageAction(5);
ActionArray[5].x = 533;
ActionArray[5].y = 665;

And the Symbol's code is as follows:

package {

    import flash.display.MovieClip;

    public class MessageAction extends MovieClip {

        //Message Action Values Key:
        // 0- Research
        // 1- Email Manager
        // 2- Get pricing from vendor
        // 3- Get pricing from distributor
        // 4- Get pricing from partner page
        // 5- Quote customer

        public static var ActionType: int = -1;
        public static var ActionName: Array = new Array("Research", "Email Manager", "Get pricing from vendor", "Get pricing from distributor", "Get pricing from partner page", "Quote Customer");
        public static var Selected:Boolean = false;
        public static var IsActive:Boolean = true;

        public function MessageAction( MyType:int ) {
            ActionType = MyType;
            this.addEventListener(Event.ENTER_FRAME, onUpdate);
            this.addEventListener(MouseEvent.CLICK, clickHandler);

        public function setType(MyType: int): void {
            ActionType = MyType;

        public function Activate(): void {
            IsActive = true;

        public function Deactivate(): void {
            IsActive = false;

        function clickHandler(me: MouseEvent): void {
            if(IsActive == true){
                if (Selected == false) {
                    Selected = true;
                } else {
                    Selected = false;

        function onUpdate(e: Event): void {

            if (IsActive == true && ActionType != -1) {
                alpha = 1;
                ActionText.text = ActionName[ActionType];
            } else {
                ActionText.text = "---";
                alpha = .5;

            if (Selected == false) {
            } else {


Any help would be greatly appreciated. Thank you.