MovieClips in an Array

Is it possible to load up an array with movieclip instances from the library and use that as a reference to go to a certain index, snag that mc, and display it on the stage?

I used cards as an example because it was hard to think of a case where this might be the right way to work!
Incidentally, you should take a look at getDefinitionByName() too. The syntax is somewhat strange, but it's on these lines:
var ClassReference:Class = getDefinitionByName("someClassName") as Class;
var instance:Object = new ClassReference();
You could get the Class of say ("Card"+i) if your movieclips were shared as Card1 - Card90. Making the whole array routine be something like:
var i:int;
var ClassRef:Class;
var cards:Array = []
for(i=1;i<=90;i++){
   ClassRef = getDefinitionByName("Card"+i) as Class;
   cards.push(new ClassRef());

Similar Messages

  • Can't duplicate movieclips as an array within an array

    Hello.
    I have an animation that loads an xml into it and traces back
    an array within an array. I have tried to apply this to duplicated
    movieclips thereby creating a structured set of links. What I am
    trying to do is this:
    Chicken Nuggets
    __Compression
    __Texture
    __Disgust
    Mega Warhead
    __Taste
    __Hardness
    __Pain
    This traces fine but I can't seem to get the duplicated
    movieclips to assemble in this fashion.
    The code for the XML is as follows:
    var controlArray:Array;
    var variable:Array;
    var testTopic = new Array ();
    var test = new Array ();
    var controlsXML:XML = new XML();
    controlsXML.ignoreWhite = true;
    controlsXML.onLoad = function(success:Boolean){
    if (success){
    var mainnode:XMLNode = controlsXML.firstChild;
    var controlNodes:Array =
    controlsXML.firstChild.firstChild.firstChild.firstChild.childNodes;
    var list:Array = new Array();
    for (var i:Number = 0; i < controlNodes.length; i++) {
    var personnode:XMLNode = controlNodes
    .attributes.Name;
    trace(personnode);
    testTopic.push (new struct (personnode));
    var specificNode:Array = controlNodes.childNodes;
    for (var j:Number = 0; j < specificNode.length; j++){
    var itemnode:XMLNode = specificNode[j].attributes.Variable;
    trace(itemnode);
    test.push (new struct2 (itemnode));
    printer ();
    printer2 ();
    } else {
    trace('error reading XML');
    controlsXML.load ("controls3.xml");
    The code for the movieclip duplication is as follows:
    x = 50;
    function printer ()
    for (m = 0; m < testTopic.length; m++)
    duplicateMovieClip ( slotTopic, "slotTopic" + m, m );
    slotTopic = eval ( "slotTopic" + m );
    slotTopic._y += x;
    slotTopic.slotTopicContent.text = testTopic[m].personnode;
    function printer2 ()
    for (k = 0; k < test.length; k++)
    duplicateMovieClip ( slot, "slot" + k, k );
    slot = eval ( "slot" + k );
    slot._y += x;
    slot.slotContent.text = test[k].itemnode;
    function struct (personnode)
    this.personnode = personnode;
    function struct2 (itemnode)
    this.itemnode = itemnode;
    On the stage are two movieclips, titled "slotTopic" and
    "slot". Within those are dynamic text boxes titled respectively
    "slotTopicContent" and "slotContent". When I preview this file it
    only displays the text within the "slot" movieclip and it lists all
    six of the subtopics with no break. So, there are two dilemmas:
    1) The movieclips won't duplicate into the structured set of
    links that I want.
    2) "slotTopic" is not displaying text at all.
    If anyone has any advice, I'd really appreciate it.
    Thx!

    ok, I'm sorry but there are quite a few things wrong here.
    first though, when posting code please use the 'attach code'
    button.
    1) i can't imagine that you have a XML structure as deep as
    your calling to or the need for it with the limited amount of
    infomation your pulling, in addition your storing the info in
    attributes, so I can't see how this would work, it may 'trace' out
    the right text (somehow) but it's not getting into the arrays
    properly.
    2) you do not assign an attribute value to a XMLNode, and
    then try to push it into an array.
    3) you do not call a method (struct or struct2) using the
    'new' operator. this is how you envoke a new 'class' instance.
    4) do not use 'x' as a variable name as it is a reserved var
    in flash, assigned to an Object instance.
    5) the duplicateMovieClip() method needs to be called upon
    the existing clip as in:
    slotTopic.duplicateMovieClip('slotTopic'+m, m);
    additionally you can pass the _y placement within the
    initObject.
    6) you do not need to use eval, it isn't doing anything here,
    you will gain the correct path by calling duplicateMovieClip
    correctly.
    7) the reason why slotTopic is not being displayed at all is
    because of the second loop, you are duplicating the clips
    (incorrectly) into the same depths thereby replacing all of the
    contents of the slotTopic depths previously constructed.
    the solution to this problem is to construct both items with
    the same loop but increament one of the depth assignments by a
    specific number, in other words at depths much higher or at least
    different, than that of the first element, as in:
    slotTopic.duplicateMovieClip('slotTopic'+m, m, {_y:50});
    slot.duplicateMovieClip('slot'+(m+100), m+100, {_y:50});
    again I'm sorry man, but it will take some work to sort this
    out.

  • Problem referring to on-stage movieclips from an array

    I have a movieclip on the stage in which I have some 90
    movieclips also on the stage.
    I created an array to hold the movieclips.
    But when I try to add eventlisteners to these movieclips by
    cycling through the array, I get a 1009 error ("Could not parse the
    XML. Error #1009: Cannot access a property or method of a null
    object reference.") Oddly, however, the application seems to work
    correctly, handling my listener events.
    On the other hand, if I add eventlisteners for each movieclip
    individually, all works fine--no errors are thrown.
    Can anyone please point out my error?

    I found the problem...
    I feel sheepish about this, but I misspelled one of the
    movieclip instance names in the code (there are 90 of these
    movieclips).
    That's why the error was thrown, but parts of the application
    still worked.
    Thanks to all who replied!

  • Referring to MovieClips using an Array

    Hello,
    I'm currently working on making a game, but I'm having trouble with switching the movie clip based on which key was pressed. I just started the code so I'm only on the basics at the moment, and keep in mind that I am new to Flash so I apologize for any stupid mistakes.
    What I am trying to do is get the character (Shu) to move using WASD, however depending on which direction he goes in, I want the movie clip to change into a different picture of Shu. I'm using three different functions for this:
    -moveShu (increases Shu's x & y coords to make him move)
    //Move Shu (SF)
      function moveShu(): void {
      if (dir == "up" && SF.y > 0) {
      SF.y -= 3;
      if (dir == "left" && SF.x > 0) {
      SF.x -= 3;
      if (dir == "down" && SF.y < 400) {
      SF.y += 3;
      if (dir == "right" && SF.x < 550) {
      SF.x += 3;
    -dFun (just gives a string of which direction key was pressed, e.g "left", "up")
    -uFun (stops the movement when keys are no longer being pressed)
    My problem is that if I'm switching the movie clip (and therefore will have a different variable name instead of SF), the moveShu function will no longer work. I considered just removing SF and replacing him with the movie clip I want, then increasing that clip's x or y coords, but then I realized the && SF.y won't work for the new movie clip.
    if (dir == "down" && SF.y < 400) {
      SF.y += 3;
    I can't get rid of the SF.y<400 coords since it prevents Shu (or the movie clip I replace him with) from just running off stage, so what I'm thinking now is that I need an array where I can input all the movie clips I want to use, and do:
    if (dir == "down" && shuArray[i].y < 400) {
      shuArray[i].y += 3;
    I really don't know how to refer an array's objects without stating the exact one that I want, but I used "i" as a number in previous codes I was taught in class which is why I think arrays might be my answer.
    Again, I'm sorry for anything obvious I overlooked, but what I need is a way to refer to an array's objects in general without having state which exact one. One last thing to note is that there will only ever be one "Shu" or character on the stage at a time, so it's not like I'll leave all the movie clips on the stage at once.
    Thanks for any help! ^^

    Because each movieclip is a different animation of Shu. I didn't think there would be a way to animate him in all eight ways in one movie clip, or at least it seemed like if I did, it would involve a lot of "gotoAndPlay" frame <number> for each of the directions.

  • Removing Movieclips from an Array Displayed on stage

    Hi Everyone ,
    I am new to AS3 so please forgive me in advance if I end up annoying anyone ;(
    I need some help in removing Movie Clips from the stage , these were initially loaded off an array
    Here is the Code with the NEXT Button , : for both ARRAYS , Notes and Notes15 ( referring to 15th frame)
    function nextframepop2(Event:MouseEvent):void{
    trace("Mouse Enabled");
    removeChild(notes15[4]);
    removeChild(notes15[3]);
    removeChild(notes15[2]);
    removeChild(notes15[1]);
    removeChild(notes15[0]);
    nextFrame();
    function nextframepop1(Event:MouseEvent):void{
    trace("Mouse Enabled");
    removeChild(notes[1]); // This is Line 635 , but I am not sure what I am doing wrong here.
    removeChild(notes[0]);
    nextFrame();
    I am calling this Function with an If Statement , I need to make sure all the Movie Clips are loaded before the End User decides to move to next slide.
    Here is what I get when I run the Next Button ,
    ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/removeChild()
    at PORTDemoPresent_fla::MainTimeline/nextframepop1()[PORTDemoPresent_fla.MainTimeline::frame 2:635]
    Can anyone please help ?

    Based on what you show it is likely that some other function (like the one before it as shown) has already removed the object.  What you should do is learn to use the trace function to troubleshoot your code.  In this case put in a trace anywhere you add or remove the same object that tells you whether it is added or removed and which line of code it is, realizing that you might be storing the same object with different references to it.  That way you should be able to isolate where things are being removed when you don't expect them to be.

  • How to access child movieclip info of an object in an array?

    Hi
    I've dynamically created a whole bunch of movieclips.
    I've given each clip a name based on a variable number:
         mc.name = "mc"+i;
    I've also use addChild to add a couple of dynamic text fields to each movieClip, named myText1 and myText2.
    I then push each movieClip object into an array:
         myArray.push(mc);
    When I addChild the movieClips, they display fine, complete with each textField.  And if I use the following loop to trace the name of each clip in the array, I get:
         for(var i=0; i<myArray.length; i++)
                   trace(myArray[i].name);
    output:
         mc1
         mc2
         mc3
         mc4
    etc
    What I want to now is be able to access the text fields within each movieclip in the array.  However, I am getting errors when I try different ways.  For example:
         for(var i=0; i<myArray.length; i++)
                   trace(myArray[i].myText1.text);
    gives the error: A term is undefined and has no properties.
    How do you access the values and contents of the children of movieClip objects that are stored in arrays?
    Thanks
    Shaun

    For whatever reason, dynamically added children cannot be targeted that way.  If you added the textfields dynamically you may need to use getChildByName() to target them.  It partly depends on how you created them and whether or not you have direct access to them.  Aside from that you could also assign the textfields to variables that you create for the mc and target those by their variable names.
    The following demos these two approaches:
    var mc:MovieClip = new MovieClip();
    addChild(mc);
    var tf:TextField = new TextField();
    tf.text = "this is text";
    mc.addChild(tf);
    // first way
    tf.name = "tfield";
    trace(TextField(mc.getChildByName("tfield")).text);
    // second way
    mc.tfid = tf;
    trace(mc.tfid.text);
    You could also store the textfields in arrays as they are created and have direct access to them with out the need to target the mc... the index should be the same as that which you use for the mc anyways.

  • Selecting one letter from a word Array (to start off a word game)

    Hi,
    I have been building a simple word game. It is smple but works fine. I am now trying to enhance some of the features.
    I would like to see if I can display one letter of each word so the Player has a hint. Think of this as a beginners level.
    The words are random from a text list. Either I can make the letters invisible and the game starts without a hint or I am able to select a letter using charAt() or creating a new variable substring()from the word which is the displayed repeatedly on the stage(not what I want)
    I have not been able to find a way to display one letter and display it in the correct order within the word and keep the remaining letters invisible.
    I am including the code below.
    I have another question regarding looping arrays but I'll wait until I figure this out.
    I hope it is not too long and I am being clear in my goals.
    Thanks
    import flash.net.URLLoader;
    import flash.events.Event;
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.events.MouseEvent;
    var loader:URLLoader;
    var allWords:Array;
    var thisWord:String;
    var textContainer:MovieClip;
    var textFields:Array;
    var textStyle:TextFormat;
    var underline:MovieClip;
    var numCorrect:uint;
    var totalLetters:uint;
    //variables for creating games scoring limits
    var misses:uint;
    var missesToLose:uint;
    //buttons for new text versions
    artists_mc.addEventListener(MouseEvent.CLICK, getArt);
    regular_mc.addEventListener(MouseEvent.CLICK, regWords);
    function intializeGame():void
        loader = new URLLoader();
        allWords = new Array();
        textContainer = new MovieClip();
        textFields = new Array();
        textStyle = new TextFormat();
        guesses_txt.text = "";
        numCorrect = 0;
        misses = 0;
        missesToLose = 5;
        misses_txt.text = "0";
        missesToLose_txt.text = "/" + missesToLose;
        textStyle.font = "Andale Mono";
        textStyle.size = 48;
        textStyle.bold = true;
        textStyle.color = 0x5FC9D7;
        textContainer.y = 125;
        addChild(textContainer);
        /*loader.load(new URLRequest("word_Game.txt"));
        loader.addEventListener(Event.COMPLETE, reg_textLoaded);*/
        guess_btn.addEventListener(MouseEvent.CLICK, guess);
    //new loader events for different textGames
    function regWords(event:MouseEvent):void
        loader.load(new URLRequest("word_Game.txt"));
        loader.addEventListener(Event.COMPLETE, reg_textLoaded);
        loader.removeEventListener(Event.COMPLETE, art_textLoaded);
        removeChild(textContainer);
        intializeGame();
    function getArt(event:MouseEvent):void
        loader.load(new URLRequest("artists.txt"));
        loader.removeEventListener(Event.COMPLETE, reg_textLoaded);
        loader.addEventListener(Event.COMPLETE, art_textLoaded);
        removeChild(textContainer);
        intializeGame();
    //self-explanatory
    function endGame(endMessage:String):void
        var winLose:MovieClip = new WinLose();
        winLose.x = stage.stageWidth / 2 - 60;
        winLose.y = stage.stageHeight / 2 - 70;
        addChild(winLose);
        winLose.end_txt.text = endMessage;
        winLose.addEventListener(MouseEvent.CLICK, startOver);
    function startOver(event:MouseEvent):void
        event.currentTarget.parent.removeChild(event.currentTarget);
        removeChild(textContainer);
        intializeGame();
    function reg_textLoaded(event:Event):void
        var tempText:TextField;
        var stringOfWords:String = event.target.data;
        allWords = stringOfWords.split(",");
        thisWord = allWords[Math.floor(Math.random() * allWords.length)];
        totalLetters = thisWord.length;
        for (var i:uint; i < thisWord.length; i++)
            tempText = new TextField();
            tempText.defaultTextFormat = textStyle;
            tempText.name = ("textField" + i);
            tempText.text = "";
            tempText.selectable = false;
            tempText.width = 48;
            tempText.x = i * tempText.width;
            textContainer.addChild(tempText);
            textFields.push(tempText);
            if (thisWord.charAt(i) != "")
                underline = new Underline();
                underline.x = tempText.x + tempText.width / 3;
                underline.y = tempText.y + tempText.height / 1.8 + 5;
                textContainer.addChild(underline);
        textContainer.x = stage.stageWidth / 2 - textContainer.width / 2;
    function art_textLoaded(event:Event):void
        var tempText:TextField;
        var stringOfWords:String = event.target.data;
        allWords = stringOfWords.split(",");
        thisWord = allWords[Math.floor(Math.random() * allWords.length)];
        totalLetters = thisWord.length;
        //var firstChar:String = thisWord.substring(0, 1);
        for (var i:uint; i < thisWord.length; i++)
            tempText = new TextField();
            tempText.defaultTextFormat = textStyle;
            tempText.name = ("textField" + i);
            tempText.text = "";
            tempText.selectable = false;
            tempText.width = 48;
            tempText.x = i * tempText.width;
            textContainer.addChild(tempText);
            textFields.push(tempText);
            if (thisWord.charAt(i) != "")
                underline = new Underline();
                underline.x = tempText.x + tempText.width / 3;
                underline.y = tempText.y + tempText.height / 1.8 + 5;
                textContainer.addChild(underline);
        textContainer.x = stage.stageWidth / 2 - textContainer.width / 2;
    function guess(event:MouseEvent):void
        if (guess_txt.text != "")
            if (thisWord.indexOf(guess_txt.text) != -1)
                for (var i:uint = 0; i < textFields.length; i++)
                    if (thisWord.charAt(i) == guess_txt.text)
                        textFields[i].text = thisWord.charAt(i);
                        numCorrect++;
                        if (numCorrect >= totalLetters)
                            endGame("You Win");
            else if (guesses_txt.text == "")
                guesses_txt.appendText(guess_txt.text);
                misses++;
            else
                guesses_txt.appendText("," + guess_txt.text);
                misses++;
            misses_txt.text = String(misses);
            if (misses >= missesToLose)
                endGame("You Lose");
        guess_txt.text = "";
    intializeGame();

    Hi,
    After many hours of reading and trying out different strategies, I began to think that I was trying to do to much in one section.
    I created a new TextField (oneLtr) used the addChild(oneLtr) and using the charAt() method was able to isolate a uniquely different letter as a hint for each new word.
    I am now trying to work out the code so the x position moves dynamicaly with each new word.
    My hope was to have a leter sitting in the exact position but right now I'm learning a lot about text and arrays so that's ok.
    Any suggestions and help is always great
    function art_textLoaded(event:Event):void
        var tempText:TextField;
        var stringOfWords:String = event.target.data;
        allWords = stringOfWords.split(",");
        thisWord = allWords[Math.floor(Math.random() * allWords.length)];
        totalLetters = thisWord.length;
        //var firstChar:String = thisWord.substring(0, 1);
        oneLtr.text = thisWord.charAt(2);
        for (var i:uint; i < thisWord.length; i++)
            tempText = new TextField();
            tempText.defaultTextFormat = textStyle;
            tempText.name = ("textField" + i);
            tempText.text = "";
            tempText.selectable = false;
            tempText.width = 48;
            tempText.x = i * tempText.width;
            textContainer.addChild(tempText);
            textFields.push(tempText);
            if (thisWord.charAt(i) != "")
                underline = new Underline();
                underline.x = tempText.x + tempText.width / 3;
                underline.y = tempText.y + tempText.height / 1.8 + 5;
                textContainer.addChild(underline);
            addChild(oneLtr);
        textContainer.x = stage.stageWidth / 2 - textContainer.width / 2;
        oneLtr.x = tempText.x - tempText.width / 3;

  • Action at the end of a MovieClip

    I've made a movieclip with an animation and I have exported
    it for AS.
    In the AS I make various entities of this movieclip and I add
    them in a array.
    At the end of my movieclip I want to execute a function (that
    should delete the movieclip from the array then auto-delete
    itself).
    1. I tried to insert in the last frame of the movieclip a
    call to a function in the AS but the movieclip doesn't found it
    (the function is found only in the main timeline).
    Is there a good mode to call a public function of the .as in
    a movieclip?
    2. Does it exist a listener on MovieClips that signal when
    these end (last frame of the MC timeline)?
    3. To auto-delete the moviclip I wrote this in the last frame
    of the movieclip: (this.parent).removeChild(this);
    Is this method right?

    I've made a movieclip with an animation and I have exported
    it for AS.
    In the AS I make various entities of this movieclip and I add
    them in a array.
    At the end of my movieclip I want to execute a function (that
    should delete the movieclip from the array then auto-delete
    itself).
    1. I tried to insert in the last frame of the movieclip a
    call to a function in the AS but the movieclip doesn't found it
    (the function is found only in the main timeline).
    Is there a good mode to call a public function of the .as in
    a movieclip?
    2. Does it exist a listener on MovieClips that signal when
    these end (last frame of the MC timeline)?
    3. To auto-delete the moviclip I wrote this in the last frame
    of the movieclip: (this.parent).removeChild(this);
    Is this method right?

  • How do I removing a specific item from an Array?

    Hi there.
    I am having an array of movieclips and when my circle(controlled with the keyboard) hitTests true with one of the movieclips inside that array i want to remove that movieclip from the array so when i hitTest it again it returns false (I hitTest using a "for in" with that array).
    How do i remove a specific item from within an array?
    Can someone help me? Thanks a lot.

    i haven't noticed anyone showing deference because of the points.  in fact, i've seen some people (a minority, to be sure) be just obnoxious about it.  i never encountered that before:  some people feel they have power because they can dole out points.
    but overall i agree with you:  the loss of the list of threads i am participating in, along with the most recent posters name, is a significant drawback of the new forums.  and there's nothing new in these forums that offsets that drawback.
    in addition, i think we've lost way more than 1/2 the older threads.  that's a lot of information that's no longer available.

  • Movie Clips in Array

    I am trying ot push attached Movieclips into an Array
    btnUp.onRelease = function():Void {
    var grp1:MovieClip = test.attachMovie("Group1", "mcOne", 1);
    myarray.push(grp1);
    I think this works.
    What I am trying to do is that after the user select the
    movieclips he or she wants (40 choices total) they will be pushed
    into an array and that when they select finished choosing the
    movieclips will appear in order in which they chose them in another
    frame or movieclip. But when it comes to arrays I am
    clueless.

    the code to display the selected movieclips (in order) is
    after the comment.
    when you're ready to start the display, set index=0 and use
    that code after the comment.
    to have those movieclips appear at a designated _x,_y assign
    myarray[index]._x and myarray[index]._y to suit your needs.

  • How to read movieClip container variables by attachmovie

    I used a movieClip to store the attach movieclip, but How to get back the variable from that movieClip container,
    such as a I set a array in the exiting movieClip
    var m_click:Array = new Array();
    for (var f=0; f<=this[mc_name+"_qty"]._totalframes-1; f++)
    { m_click[f] = 0; }
    I want the attached movieClip "y_qty" with a button inside to get the m_click for changing each m_click[0]..m_click[1]..value, how to do it?
    Thanks

    As I want to build a supermarket interface with number of 2x3 or 2x2 cells in every shelf,
    I prepare at least more than 6 items in 1 mc for attachmovie randomly in each cell.
    On the other hand, I need to attachmovie of  the selected items in a shopping cart list with quantity information, and
    removed it in cart list when click until tthe quantity is zero.
    So, I added a button inside the attachmovie to count and store the times on each frame click and currentframe no with items id in array.
    Now is much trouble to store array item_id[n] without repeat, if repeat, add to item_qty[n]++

  • Using an array to assign movie clips to buttons

    Thanks in advance for any help you can give me!!
    I've got 5 movie clip buttons.  When a user rolls over a button, I want one movie clip to play. When a user clicks on that button, an alternate movie clip plays. I'm trying to use an array to assign certain movie clips to certain buttons and actions, but I'm not doing something quite right. I can get one button to work correctly, but then am having issues getting the other buttons to work.
    Here is the code I have:
    var currentPage:MovieClip;
    var currentScreen:MovieClip;
    var prevPage:MovieClip;
    var currentButton:MovieClip;
    var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
       {button:m2_mcButton, page:m2_mc, screen:s2_mc}]
    for(var i=0;i<arrNavigation.length;i++){
    arrNavigation[i].button.buttonMode=true;
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
    function onButtonOver(e:MouseEvent):void
    for(i=0;i<arrNavigation.length;i++) {
    if(arrNavigation[i].button == e.currentTarget)
    currentPage = arrNavigation[i].page;
    currentPage.gotoAndStop("over");
    function onButtonOut(e:MouseEvent):void{
    currentPage.gotoAndStop("out");
    function onButtonClick(e:MouseEvent):void{
    for(i=0;i<arrNavigation.length;i++) {
    if(arrNavigation[i].button == e.currentTarget)
    currentScreen = arrNavigation[i].screen;
    arrNavigation[i].screen.gotoAndPlay("over");

    if your buttons are movieclips, use:
    var currentPage:MovieClip;
    var currentScreen:MovieClip;
    var prevPage:MovieClip;
    var currentButton:MovieClip;
    var arrNavigation:Array = [{button:m1_mcButton, page:m1_mc, screen:s1_mc},
       {button:m2_mcButton, page:m2_mc, screen:s2_mc}]
    for(var i=0;i<arrNavigation.length;i++){
    arrNavigation[i].button.buttonMode=true;
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OVER, onButtonOver);
    arrNavigation[i].button.addEventListener(MouseEvent.ROLL_OUT, onButtonOut);
    arrNavigation[i].button.addEventListener(MouseEvent.CLICK, onButtonClick);
    arrNavigation[i].button.ivar=i;
    function onButtonOver(e:MouseEvent):void
    currentPage = arrNavigation[e.currentTarget.ivar].page;
    currentPage.gotoAndStop("over");
    function onButtonOut(e:MouseEvent):void{
    currentPage.gotoAndStop("out");
    function onButtonClick(e:MouseEvent):void{
    currentScreen = arrNavigation[e.currentTarget.ivar].screen;
    currentScreen.gotoAndPlay("over");

  • Need help returning correct name from a code created movie clip

    Hello. I am an AS3 n00b with hopefuly a simple question I am designing a simple game in flash. This code creates an array of movie clips and asigns a picture to each one. It is a map screen. What I need is when I click on one of the created movie clips, I need it to return either the index of the clip in the array or the name of the clip. Basicaly anything I can use to tell them apart in the code. Here is the code:
    import flash.display.MovieClip;
    var MapLoader:Array = new Array();
    var strJPGext:String = ".jpg";
    var intContTileNumber:int;
    var strContTilePath:String;
    var intDistStartX:int = 63;
    var intDistStartY:int = 64;
    var intDistMultiplyY:int = 0;
    var intDistMultiplyX:int = 0;
    var intDistCount:int = 0;
    var MapSquare:Array = new Array();
    for (var i:int = 0; i < 729; i++)
             //var MapSquare:MovieClip = new MovieClip();
            MapSquare.push (new MovieClip());
            MapSquare[i].x = intDistStartX + (intDistMultiplyX * 30);
            MapSquare[i].y = intDistStartY + (intDistMultiplyY * 30);
            MapSquare[i].name = "MapSquare" + i ;
            addChild(MapSquare[i]);
            intContTileNumber = i;
            MapLoader.push (new Loader);
            strContTilePath = intContTileNumber + strJPGext;
            MapLoader[i].load(new URLRequest(strContTilePath));
            MapSquare[i].addChild(MapLoader[i]);
            intDistCount++;
            intDistMultiplyX++;
            if (intDistCount > 26){
            intDistCount = 0;
            intDistMultiplyX = 0;
            intDistMultiplyY++;
    stage.addEventListener(MouseEvent.CLICK, reportClick);
    function reportClick(event:MouseEvent):void
        trace("movieClip Instance Name = " + event.target.name);   
    Now all this works fine, it creates the map and assigns the correct picture and places them in the correct X,Y position and it is the correct grid of 27x27 squares. The problem is with the name, when I click on the movie clip, it returns "Instance2" or "Instance5" or whatever. It starts with 2 and then increases each number by 3 for each clip, so the first one is 2, then 5 then 8 and so on. This is no good. I need it to return the name that I assigned it
    . If I put the code in trace(MapSquare[1]) it will return the name "MapSquare1" so I know the name was assigned, but it isnt returning.
    Please assist
    Thanks,
    -red

    Thanks for the resopnse,
    I know I dont really need the name, I just need the index number of the array, but I cant figure out how to get the index name without specificaly coding for it. That is why in the listener event I use event.target.name because I dont know what movie clip is being clicked until it has been clicked on. Basically when a movie clip is clicked it needs to return which index of the array was clicked.
    I could do it this way:
    MapSquare[0].addEventListener(
      MouseEvent.MOUSE_UP,
      function(evt:MouseEvent):void {
        trace("I've been clicked!");
    MapSquare[1].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    MapSquare[2].addEventListener(
       MouseEvent.MOUSE_UP,
       function(evt:MouseEvent):void {
         trace("I've been clicked!");
    ... ect
    but that is unreasonable and it kind of defeats the purpose of having the array in the first place. The code that each movie clip executes is the same, eventualy that index will be passed into a database and the data at that primary key will be retrieved and returned to the program. So I just need to know, when one of those buttons is clicked, which one was clicked and what is its index in the array.
    I am a VB programer and in VB this is very easy, the control array automatically sends its own index into the function when one of the buttons is clicked. It seems simple enough, I just dont know how to do it in action script.
    Thanks again,
    -red

  • How do I reposition image scroller bar from middle to the right

    I am customising an image thumb scroller. and trying to follow up previously developed code.
    All worked fine until the last moment when thumbnails bar is positioned as if its starting point is in the middle of the screen. I suppose it was developed for the flash screen layout with centered coordinates. My stage probably has them set to the upper left corner.
    I can not make the bar move.
    My stage size is 1024 x 768
    Where do I do my math in the code so the thumbnails will be located in the middle of the screen rather than in its right hand.
    Here are the code snippets responsible for the thumbnails build up:
      const _THUMB_WIDTH:Number = 50;
      const _THUMB_HEIGHT:Number = 64;
      const _IMAGE_WIDTH:Number = 860;//550;original #
      const _IMAGE_HEIGHT:Number = 500;//355;original #
      const _THUMB_GAP:Number = 2;
      const _SCROLL_SPEED:Number = 12;
      const _SCROLL_AREA:Number = 150;
    var _progressBar:MovieClip;
    var _arrowLeft:MovieClip;
    var _arrowRight:MovieClip;
    var _slides:Array;
    var _curSlide:Slide; //Slide that is currently displaying
    var _loadingSlide:Slide; //only used when a Slide is supposed to show but hasn't been fully loaded yet (like if the user clicks "next" many times before all the images have loaded). We keep track of the one that's in the process of loading and should be shown as soon as it finishes, then we set _loadingSlide back to null.
    var _imagesContainer:Sprite; //the Sprite into which the full-size images are placed (this helps manage the stacking order so that the images can always be behind everything else and yet we can addChild() each image so that it shows up on top of the previous one)
    var _thumbnailsContainer:Sprite; //the Sprite into which the thumbnail images are placed. This also allows us to slide them all at the same time.
    var _destScrollX:Number = 0; //destination x value for the _thumbnailsContainer which is used for scrolling it across the bottom. We don't want to use _thumbnailsContainer.x because it could be in the process of tweening, so we keep track of the end/destination value and add/subtract from it when creating our tweens.
    var _minScrollX:Number; //we know the maximum x value for _thumbnailsContainer is 0, but the mimimum value will depend on how many thumbnail images it contains (the total width). We calculate it in the _setupThumbnails() method and store it here for easier/faster scrolling calculations in the _enterFrameHandler()
    _thumbnailsContainer = new Sprite();
    addChild(_thumbnailsContainer);
    //_thumbnailsContainer.x = -550;//moves x position of thumbnails, instead done in line 273 thumbnail.x = curX - 590;
    _thumbnailsContainer.y = _IMAGE_HEIGHT;//moves y position of thumbnails
    _thumbnailsContainer.alpha = 0; //we want alpha 0 initially because we'll fade it in later when the thumbnails load.
    _thumbnailsContainer.visible = false; //ensures nothing is clickable.
    var xmlLoader:XMLLoader = new XMLLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/data.xml", {onComplete:_xmlCompleteHandler});
    xmlLoader.load();
    function _xmlCompleteHandler(event:LoaderEvent):void {
    _slides = [];
    var xml:XML = event.target.content; //the XMLLoader's "content" is the XML that was loaded.
    var imageList:XMLList = xml.image; //In the XML, we have <image /> nodes with all the info we need.
    //loop through each <image /> node and create a Slide object for each.
    for each (var image:XML in imageList) {
    _slides.push( new Slide(image.@name,
    image.@description,
    new ImageLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/thumbnails/appThmb_imgs/" + image.@name + ".jpg",
    name:image.@name + "Thumb",
    width:_THUMB_WIDTH,
    height:_THUMB_HEIGHT,
    //centerRegistration:true,
    //x:260, y:320,//doesn't work here but works in line 69
    scaleMode:"proportionalInside",
    bgColor:0x000000,
    estimatedBytes:13000,
    onFail:_imageFailHandler}),
    //loops through all the thumbnail images and places them in the proper order across the bottom of the screen and adds CLICK_THUMBNAIL listeners.
    function _setupThumbnails():void {
    var l:int = _slides.length;
    var curX:Number = _THUMB_GAP;
    for (var i:int = 0; i < l; i++) {
    var thumbnail:Sprite = _slides[i].thumbnail;
    _thumbnailsContainer.addChild(thumbnail);
    TweenLite.to(thumbnail, 0, {colorTransform:{brightness:0.5}});
    _slides[i].addEventListener(Slide.CLICK_THUMBNAIL, _clickThumbnailHandler, false, 0, true);
    thumbnail.x = curX;
    thumbnail.y = -234;//defines y position of the thumbnails row
    curX += _THUMB_WIDTH + _THUMB_GAP;
    _minScrollX = _IMAGE_WIDTH - curX;
    if (_minScrollX > 0) {
    _minScrollX = 0;
    function _enterFrameHandler(event:Event):void {
    if (_thumbnailsContainer.hitTestPoint(this.stage.mouseX, this.stage.mouseY, false)) {
    if (this.mouseX < _SCROLL_AREA) {
    _destScrollX += ((_SCROLL_AREA - this.mouseX) / _SCROLL_AREA) * _SCROLL_SPEED;
    if (_destScrollX > 0) {  //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number below
    _destScrollX = 0;    //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number above
    TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
    } else if (this.mouseX > _IMAGE_WIDTH - _SCROLL_AREA) {
    _destScrollX -= ((this.mouseX - (_IMAGE_WIDTH - _SCROLL_AREA)) / _SCROLL_AREA) * _SCROLL_SPEED;
    if (_destScrollX < _minScrollX) {
    _destScrollX = _minScrollX;
    TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});

    Hi, thanks for taking a look at my problem.
    I assume that the code was difficult to read due to an unusual line brakes, which somehow I got when pasting on this site.
    Please take a look I am pasting the code anew in it entirety:
    (please let me know if you would like me to separate the areas which I believe give me troubles to address my previously describe problem:
    All worked fine until the last moment when thumbnails bar is positioned as if its starting point is in the middle of the screen. I suppose it was developed for the flash screen layout with centered coordinates. My stage probably has them set to the upper left corner.
    I can not make the bar move.
    My stage size is 1024 x 768
    Where do I do my math in the code so the thumbnails will be located in the middle of the screen rather than in its right hand.)
    (Also wanted to mention that there an external file Slide.as which is not responsible for the construction and positioning of the thumbnails)
              import com.greensock.*;
              import com.greensock.loading.*;
              //import com.greensock.events.LoaderEvent;
              import com.greensock.loading.display.*;
              //import com.greensock.TweenLite;
              import com.greensock.events.LoaderEvent;
              //import com.greensock.loading.ImageLoader;
              //import com.greensock.loading.SWFLoader;
              //import com.greensock.loading.LoaderMax;
              //import com.greensock.loading.XMLLoader;
              import com.greensock.plugins.AutoAlphaPlugin;
              import com.greensock.plugins.ColorTransformPlugin;
              import com.greensock.plugins.GlowFilterPlugin;
              import com.greensock.plugins.BlurFilterPlugin;//i added this filter to blur the progressBar
              import com.greensock.plugins.TweenPlugin;
              import flash.display.MovieClip;
              import flash.display.Sprite;
              import flash.events.Event;
              import flash.events.MouseEvent;
              //public class SlideshowExample extends MovieClip {
                          const _THUMB_WIDTH:Number = 50;
                          const _THUMB_HEIGHT:Number = 64;
                          const _IMAGE_WIDTH:Number = 860;//550;original #
                          const _IMAGE_HEIGHT:Number = 500;//355;original #
                          const _THUMB_GAP:Number = 2;
                          const _SCROLL_SPEED:Number = 12;
                          const _SCROLL_AREA:Number = 150;
                         var _progressBar:MovieClip;
                         var _arrowLeft:MovieClip;
                         var _arrowRight:MovieClip;
                         var _slides:Array;
                         var _curSlide:Slide; //Slide that is currently displaying
                         var _loadingSlide:Slide; //only used when a Slide is supposed to show but hasn't been fully loaded yet (like if the user clicks "next" many times before all the images have loaded). We keep track of the one that's in the process of loading and should be shown as soon as it finishes, then we set _loadingSlide back to null.
                         var _imagesContainer:Sprite; //the Sprite into which the full-size images are placed (this helps manage the stacking order so that the images can always be behind everything else and yet we can addChild() each image so that it shows up on top of the previous one)
                         var _thumbnailsContainer:Sprite; //the Sprite into which the thumbnail images are placed. This also allows us to slide them all at the same time.
                         var _destScrollX:Number = 0; //destination x value for the _thumbnailsContainer which is used for scrolling it across the bottom. We don't want to use _thumbnailsContainer.x because it could be in the process of tweening, so we keep track of the end/destination value and add/subtract from it when creating our tweens.
                         var _minScrollX:Number; //we know the maximum x value for _thumbnailsContainer is 0, but the mimimum value will depend on how many thumbnail images it contains (the total width). We calculate it in the _setupThumbnails() method and store it here for easier/faster scrolling calculations in the _enterFrameHandler()
                         //function SlideshowExample() {
                                  //super();
                                  //activate the plugins that we'll be using so that TweenLite can tween special properties like filters, colorTransform, and do autoAlpha fades.
                                  TweenPlugin.activate([AutoAlphaPlugin, ColorTransformPlugin, GlowFilterPlugin, BlurFilterPlugin]);//i added BlurFilterPlugin at the end
                                  _progressBar = this.getChildByName("progress_mc") as MovieClip;
                                  _arrowLeft = this.getChildByName("arrowLeft_mc") as MovieClip;
                                  _arrowRight = this.getChildByName("arrowRight_mc") as MovieClip;
                                  //////////my additions to make progress bay blurry
                                  TweenLite.to(progress_mc.progressBar_mc.gradientbar_appLoader_mcPopUp_mc, 0, {blurFilter:{blurX:21, blurY:8}});//i added this line to make ProgressBar_mc to blur
                                  TweenLite.to(progress_mc.rectangleGray, 0, {blurFilter:{blurX:21, blurY:8}});//i added this line to make ProgressBar_mc to blur
                                  _arrowLeft.visible = _arrowRight.visible = false;
                                  _imagesContainer = new Sprite();
                                  this.addChildAt(_imagesContainer, 0);
                                  _thumbnailsContainer = new Sprite();
                                  addChild(_thumbnailsContainer);
                                  //_thumbnailsContainer.x = -550;//moves x position of thumbnails, instead done in line 273 thumbnail.x = curX - 590;
                                  _thumbnailsContainer.y = _IMAGE_HEIGHT;//moves y position of thumbnails
                                  _thumbnailsContainer.alpha = 0; //we want alpha 0 initially because we'll fade it in later when the thumbnails load.
                                  _thumbnailsContainer.visible = false; //ensures nothing is clickable.
                                  var xmlLoader:XMLLoader = new XMLLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/data.xml", {onComplete:_xmlCompleteHandler});
                                  xmlLoader.load();
                         function _xmlCompleteHandler(event:LoaderEvent):void {
                                  _slides = [];
                                  var xml:XML = event.target.content; //the XMLLoader's "content" is the XML that was loaded.
                                  var imageList:XMLList = xml.image; //In the XML, we have <image /> nodes with all the info we need.
                                  //loop through each <image /> node and create a Slide object for each.
                                  for each (var image:XML in imageList) {
                                            _slides.push( new Slide(image.@name,
                                                                                                        image.@description,
                                                                                                        new ImageLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/thumbnails/appThmb_imgs/" + image.@name + ".jpg",
                                                                                                                                                          name:image.@na me + "Thumb",
                                                                                                                                                          width:_THUMB_W IDTH,
                                                                                                                                                          height:_THUMB_ HEIGHT,
                                                                                                                                                          //centerRegist ration:true,
                                                                                                                                                          //x:260, y:320,//doesn't work here but works in line 69
                                                                                                                                                          scaleMode:"pro portionalInside",
                                                                                                                                                          bgColor:0x0000 00,
                                                                                                                                                          estimatedBytes :13000,
                                                                                                                                                          onFail:_imageF ailHandler}),
                                                                                                        new SWFLoader("loadingAssets/appThumbnails/slideshow_image scroller greenSock_mine/assets/images/" + image.@name + ".swf",
                                                                                                                                                  name:image.@name + "Image",
                                                                                                                                                  width:_IMAGE_WIDTH,
                                                                                                                                                  height:_IMAGE_HEIGHT,
                                                                                                                                                  //centerRegistration:true,
                                                                                                                                                  x:-420, y:-260,
                                                                                                                                                  scaleMode:"proportionalInside",
                                                                                                                                                  bgColor:0x000000,
                                                                                                                                                  estimatedBytes:820000,
                                                                                                                                                  onFail:_imageFailHandler})
                                  //now create a LoaderMax queue and populate it with all the thumbnail ImageLoaders as well as the very first full-size ImageLoader. We don't want to show anything until the thumbnails are done loading as well as the first full-size one. After that, we'll create another LoaderMax queue containing the rest of the full-size images that will load silently in the background.
                                  var initialLoadQueue:LoaderMax = new LoaderMax({onComplete:_initialLoadComplete, onProgress:_progressHandler});
                                  for (var i:int = 0; i < _slides.length; i++) {
                                            initialLoadQueue.append( _slides[i].thumbnailLoader );
                                  initialLoadQueue.append(_slides[0].imageLoader); //make sure the very first full-sized image is loaded initially too.
                                  initialLoadQueue.load();
                                  _setupThumbnails();
                         function _initialLoadComplete(event:LoaderEvent):void {
                                  //now that the initial load is complete, fade out the progressBar. autoAlpha will automatically set visible to false once alpha hits 0.
                                  TweenLite.to(_progressBar, 0.5, {autoAlpha:0});
                                  //fade in the thumbnails container
                                  TweenLite.to(_thumbnailsContainer, 1, {autoAlpha:1});
                                  _setupArrows();
                                  //setup the ENTER_FRAME listeners that controls the thumbnail scrolling behavior at the bottom
                                  this.stage.addEventListener(Event.ENTER_FRAME, _enterFrameHandler, false, 0, true);
                                  //now put all the remaining images into a LoaderMax queue that will load them one-at-a-time in the background in the proper order. This can greatly improve the user's experience compared to loading them on demand which forces the user to wait while the next image loads.
                                  var imagesQueue:LoaderMax = new LoaderMax({maxConnections:1});
                                  for (var i:int = 1; i < _slides.length; i++) {
                                            imagesQueue.append( _slides[i].imageLoader );
                                  imagesQueue.load();
                                  //now start the slideshow
                                  _showNext(null);
                        //loops through all the thumbnail images and places them in the proper order across the bottom of the screen and adds CLICK_THUMBNAIL listeners.
                         function _setupThumbnails():void {
                                  var l:int = _slides.length;
                                  var curX:Number = _THUMB_GAP;
                                  for (var i:int = 0; i < l; i++) {
                                            var thumbnail:Sprite = _slides[i].thumbnail;
                                            _thumbnailsContainer.addChild(thumbnail);
                                            TweenLite.to(thumbnail, 0, {colorTransform:{brightness:0.5}});
                                            _slides[i].addEventListener(Slide.CLICK_THUMBNAIL, _clickThumbnailHandler, false, 0, true);
                                            thumbnail.x = curX;
                                            thumbnail.y = -234;//defines y position of the thumbnails row
                                            curX += _THUMB_WIDTH + _THUMB_GAP;
                                  _minScrollX = _IMAGE_WIDTH - curX;
                                  if (_minScrollX > 0) {
                                            _minScrollX = 0;
                         function _setupArrows():void {
                                  _arrowLeft.alpha = _arrowRight.alpha = 0;
                                  _arrowLeft.visible = _arrowRight.visible = true;
                                  _arrowLeft.addEventListener(MouseEvent.ROLL_OVER, _rollOverArrowHandler, false, 0, true);
                                  _arrowLeft.addEventListener(MouseEvent.ROLL_OUT, _rollOutArrowHandler, false, 0, true);
                                  _arrowLeft.addEventListener(MouseEvent.CLICK, _showPrevious, false, 0, true);
                                  _arrowRight.addEventListener(MouseEvent.ROLL_OVER, _rollOverArrowHandler, false, 0, true);
                                  _arrowRight.addEventListener(MouseEvent.ROLL_OUT, _rollOutArrowHandler, false, 0, true);
                                  _arrowRight.addEventListener(MouseEvent.CLICK, _showNext, false, 0, true);
                         function _showNext(event:Event=null):void {
                                  //if there's a _loadingSlide we should assume that the next Slide would be AFTER that one. Otherwise just get the one after the _curSlide.
                                  var next:int = (_loadingSlide != null) ? _slides.indexOf(_loadingSlide) + 1 : _slides.indexOf(_curSlide) + 1;
                                  if (next >= _slides.length) {
                                            next = 0;
                                  _requestSlide(_slides[next]);
                         function _showPrevious(event:Event=null):void {
                                  //if there's a _loadingSlide we should assume that the previous Slide would be BEFORE that one. Otherwise just get the one before the _curSlide.
                                  var prev:int = (_loadingSlide != null) ? _slides.indexOf(_loadingSlide) - 1 : _slides.indexOf(_curSlide) - 1;
                                  if (prev < 0) {
                                            prev = _slides.length - 1;
                                  _requestSlide(_slides[prev]);
                         function _requestSlide(slide:Slide):void {
                                  if (slide == _curSlide) {
                                            return;
                                  //kill the delayed calls to _showNext so that we start over again with a 5-second wait time.
                                  TweenLite.killTweensOf(_showNext);
                                  if (_loadingSlide != null) {
                                            _cancelPrioritizedSlide(); //the user must have skipped to another Slide and didn't want to wait for the one that was loading.
                                  //if the requested Slide's full-sized image hasn't loaded yet, we need to show the progress bar and wait for it to load.
                                  if (slide.imageLoader.progress != 1) {
                                            _prioritizeSlide(slide);
                                            return;
                                  //fade the old Slide and make sure it's not highlighted anymore as the current Slide.
                                  if (_curSlide != null) {
                                            TweenLite.to(_curSlide.image, 0.5, {autoAlpha:0});
                                            _curSlide.setShowingStatus(false);
                                  _curSlide = slide;
                                  _imagesContainer.addChild(_curSlide.image); //ensures the image is at the top of the stacking order inside the _imagesContainer
                                  TweenLite.to(_curSlide.image, 0.5, {autoAlpha:1}); //fade the image in and make sure visible is true.
                                  _curSlide.setShowingStatus(true); //adds an outline to the image indicating that it's the currently showing Slide.
                                  TweenLite.delayedCall(5, _showNext); //create a delayedCall that will call _showNext in 5 seconds.
                         function _prioritizeSlide(slide:Slide):void {
                                  TweenLite.to(_progressBar, 0.5, {autoAlpha:1}); //show the progress bar
                                  _loadingSlide = slide;
                                  _loadingSlide.imageLoader.addEventListener(LoaderEvent.PROGRESS, _progressHandler);
                                  _loadingSlide.imageLoader.addEventListener(LoaderEvent.COMPLETE, _completePrioritizedHandler);
                                  _loadingSlide.imageLoader.prioritize(true); //when the loader is prioritized, it will jump to the top of any LoaderMax queues that it belongs to, so if another loader is in the process of loading in that queue, it will be canceled and this new one will take over which maximizes bandwidth utilization. Once the _loadingSlide is done loading, the LoaderMax queue(s) will continue loading the rest of their images normally.
                         function _cancelPrioritizedSlide():void {
                                  TweenLite.to(_progressBar, 0.5, {autoAlpha:0}); //hide the progress bar
                                  _loadingSlide.imageLoader.removeEventListener(LoaderEvent.PROGRESS, _progressHandler);
                                  _loadingSlide.imageLoader.removeEventListener(LoaderEvent.COMPLETE, _completePrioritizedHandler);
                                  _loadingSlide = null;
                         function _completePrioritizedHandler(event:LoaderEvent):void {
                                  var next:Slide = _loadingSlide; //store it in a local variable first because _cancelPrioritizedSlide() will set _loadingSlide to null.
                                  _cancelPrioritizedSlide();
                                  _requestSlide(next);
                         function _progressHandler(event:LoaderEvent):void {
                                  _progressBar.progressBar_mc.scaleX = event.target.progress;
                         function _clickThumbnailHandler(event:Event):void {
                                  _requestSlide(event.target as Slide);
                         function _rollOverArrowHandler(event:Event):void {
                                  TweenLite.to(event.currentTarget, 0.5, {alpha:1});
                         function _rollOutArrowHandler(event:Event):void {
                                  TweenLite.to(event.currentTarget, 0.5, {alpha:0});
                         function _enterFrameHandler(event:Event):void {
                                  if (_thumbnailsContainer.hitTestPoint(this.stage.mouseX, this.stage.mouseY, false)) {
                                            if (this.mouseX < _SCROLL_AREA) {
                                                      _destScrollX += ((_SCROLL_AREA - this.mouseX) / _SCROLL_AREA) * _SCROLL_SPEED;
                                                      if (_destScrollX > 0) {  //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number below
                                                                _destScrollX = 0;    //this number is 1/2 the stage size, previously was at 0 it defines the left position of the thumbnails scroll end, has to be indentical to the number above
                                                      TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
                                            } else if (this.mouseX > _IMAGE_WIDTH - _SCROLL_AREA) {
                                                      _destScrollX -= ((this.mouseX - (_IMAGE_WIDTH - _SCROLL_AREA)) / _SCROLL_AREA) * _SCROLL_SPEED;
                                                      if (_destScrollX < _minScrollX) {
                                                                _destScrollX = _minScrollX;
                                                      TweenLite.to(_thumbnailsContainer, 0.5, {x:_destScrollX});
                        //if an image fails to load properly, remove it from the slideshow completely including its thumbnail at the bottom.
                         function _imageFailHandler(event:LoaderEvent):void {
                                  var slide:Slide;
                                  var i:int = _slides.length;
                                  while (--i > -1) {
                                            slide = _slides[i];
                                            if (event.target == slide.thumbnailLoader || event.target == slide.imageLoader) {
                                                      slide.dispose();
                                                      _slides.splice(i, 1);
                                                      _setupThumbnails();
                                                      return;

  • How to preserve special characters in dynamic textfield for text comparison?

    The problem is as follows:
    Since I mostly develop for multiple languages I am forced to have dynamic textfields in my buttons which contain three lines (to account for the differnt text.lengths in different languages).
    I then populate the textfields with strings out of an array or xml and use the textfields contents later in my button class to execute different code depending on the textfields content.
    This works fine as long as I don`t use any special characters, like for example "\n".
    var labels:Array = ["\nLABEL1","LABEL\n\n2"];
    switch (e.currentTarget.txt.text)
                    case labels[0]:
                        doSomething();
                        break;
                    case labels[1]:
                        doSomethingElse();
                        break;
    shows the right thing in the button label (breaks the text were I want it)
    but stops to work
    (with htmlText &  <br> its the same)
    my workaround for the moment is to use filler spaces,
    var labels:Array = ["                   LABEL1","LABEL                                                                        2"];
    but that`s obviously ugly to setUp and requires a lot of trial/error to get it right for all languages.
    Any ideas how to bypass that?

    Bad habits die hard ;-)
    Weird enough spelling the problem out and getting this response from you cleared my head and  I finally got an easy solution.
    I simply attach a dynamic property to the movieclip, copy the array contents into them and instead of using the text-property for comparison I compare the MovieClips fresh created spectext property.
    Voila: Now I can be lazy without too much of a bad conscience.

Maybe you are looking for

  • Sharing computer with 2 ipods

    My son and I share a single computer for our ipods. We set up a seperate user account in Windows XP, however when we open itunes in his account, there is a lock symbol at the bottom of the itunes browser. His ipod is recognized, but we can not add so

  • Upgrading from 8.5 to 11

    Hello, The company I am working at has a large number of reports that have been created using CR 8.5. Due to a planned upgrade of the ERP system, CR needs to be upgraded to CR 11. Will the reports that have been created seamlessly work with CR 11 or

  • PopUp User&Pass / URL iViews / Portal cannot handle this?!

    Hi There, i`ve created some URL iViews and other iViews to Pages (Urls etc) that needs Authentification via User and Password. So the PopUp comes up for User and Pass.. but when i enter the Data and click ok the PopUp comes up again and again... afte

  • IS CRM AND ECC 5.0 INTEGRATED

    Hello Experts        I want to know CRM is integrated with ECC or we need to integrate with XI

  • Need help to reinstahl CS3+ jpg CS5 in Mavevick?

    I Need help to reinstahl CS3+ jpg CS5 in Mavevick, apple site says is ok, adobe site also but my cds do not instal, cmputer Imac2,66 GHz intel core i5-  4GB 1067 mhz DDR r ?