Jump to content
Search Community

freedom1k

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by freedom1k

  1. Hello,

    Within a XmL I have Instance names and Info that I used to link a Person's Pics which displays when certain buttons are picked. Works well.

    I decided to add a Combo box, linked to the same XML and display people name. I hope to have the Button Glow and Change color when a name is selected.

    I was able to trace and capture the Instance name of the button based on the selected name.

     

    the buttons are located within a MC:

    stillIsoPlan_MC.staff098

    the sample variable below combines the selected name with a string to trace the exact format above.

    var gettingMCObject:String = ( "stillIsoPlan_MC." + xmlGridValue[numSelect] );

    In testing if I TweenMax the variable I get: 

      TweenMax.to(gettingMCObject, 1, {colorTransform:{tint:0xff0000}});  
        TypeError: Error #1010: A term is undefined and has no properties.

     

     

     

    But if I hard Code the buttons location, the color change works fine:

    TweenMax.to(stillIsoPlan_MC.staff098, 1, {colorTransform:{tint:0xff0000}});

    Is there a way to use Instance Name from a String with the TweenMax feature?

    Also, can you use the yoyo: property in TweemMax.to to isolate the color and glow of a mc or btn?

     

    Your guidance is much appreciated!

     

    Below is the code segment :

    // ComboList 
    myComBoBox.prompt = "Select Staff: "; 
    var xmlLoader:URLLoader = new URLLoader();
    var xmlArry:Array = new Array();
    var xmlGridValue:Array = new Array();
    var comboXMLData:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("StaffListFromXMLSchema.xml"));
    function LoadXML(e:Event):void{
    comboXMLData  = new XML(e.target.data);
    //trace(comboXMLData.staffInfo.length());
    for(var i:uint=0;i<comboXMLData.staffInfo.length();i++)
    {
    xmlArry.push(comboXMLData.staffInfo.staffName[i]);
    xmlGridValue.push(comboXMLData.staffInfo.gridValue[i]);
    myComBoBox.dataProvider.sortOn("label");
    myComBoBox.addItem( { label: xmlArry[i], data:i } );
    myComBoBox.addEventListener(Event.CHANGE, doAction);
    }
    }
    function doAction (e:Event):void
    {
    var numSelect:Number = Number(myComBoBox.selectedItem.data);  //data to line number
    trace(xmlArry[numSelect]);
    trace(xmlGridValue[numSelect]);
    var gettingMCObject:String = ( "stillIsoPlan_MC." + xmlGridValue[numSelect] );
    var prefixMCname:String = "stillIsoPlan_MC.";
    trace(gettingMCObject);
    //TweenMax.to(stillIsoPlan_MC.manager08, 1, {glowFilter:{color:0x91e600, alpha:1, blurX:30, blurY:30, strength:1, quality:2}, ease:Elastic.easeInOut});
    TweenMax.to(stillIsoPlan_MC.xmlGridValue[numSelect], 1, {colorTransform:{tint:0xff0000}});
    }

    sample xml format: gridValue = Instance Name of buttons

     

     

    <staffInfo>
    <gridValue>manager12</gridValue>
    <staffName>Hunting, Joe </staffName>
    <quickDail>59xxx</quickDail>
    <staffPhone>(6xx) 9xx-9xxx</staffPhone>
    <staffPC>OH02-XXXX</staffPC>
    <staffPcPort>0000D1</staffPcPort>
    <imageLarge>StaffPics/LowRes/Hunting, Joe_LR.jpg</imageLarge>
    </staffInfo>

     

     

     

  2. Hi Carl,

    I did some more digging via your snorkl.tv "Mega List" page.

    (Oh, i'm sort of just getting uptodate, so congrats on your career move, or I should say happy belated anniversary!)

    You kind of answered my question in the "Death to Conditional Statements video!

     

    I just added an array to the above tweenText function:

     
    function tweenText(boxTxt) {
    var letter_array:Array = [ "A", "B", "C", "D", "E", "F", "G",
                                 "H", "I", "J", "K", "L", "M", "N",
                                 "O", "P", "Q", "R", "S", "T", "U",
                                 "V", "W", "X", "Y", "Z" ];
    var numLetters:int = letter_array.length;
    var count:int = 0;
    var ranDigit:int =(Math.random()*26);
    boxTxt.randomLetter_txt.text = letter_array[ranDigit];  
    } 

    then randomize the index. Works like a charm!

     

    Would there be any learning videos added to the GS Learning site, or are those about of a Club membership?  :)

     

    Thanks for your help.

  3. hmmm.. just tried it. But it reveals only Numbers now. 

    (See attached image.)

     

    Wouldn't your suggested tweenText function just randomly pick numbers from 0-10, not the random alphabet index from the getRandomLetter function?

    boxTxt.randomLetter_txt.text = int(Math.random()*10);

    Attached is the latest fla file, with full code.

    I'll keep this for my lottery numbers.  :)  could be a winning solution.

    RandomLetter_showing Numbers.zip

    post-17217-0-33505900-1384545571_thumb.jpg

  4. Thanks Carl,

    Surprizingly simple tip. I thought for sure it would work.

    I got the same result, but with many blinking of the swf after the boxes rested in place.

     

    I added the new TweenMax here in the code:

                    TweenMax.to(boxTxt.solid_mc, 0, {tint:Math.random()*0xffffff})
                    TweenMax.to(boxTxt, 1, {x:Math.random()*1200, y:Math.random()*800, rotationY:360, onComplete:deBlur, onCompleteParams:[boxTxt], onUpdate:tweenText, onUpdateParams:[boxTxt]})
                    tl.insert(TweenMax.to(boxTxt, 1, {x:Math.random()*1200, y:Math.random()*800, rotationY:360, onComplete:deBlur, onCompleteParams:[boxTxt]}), i*.01);
                    tl.insert(TweenMax.to(boxTxt, .1, {alpha:0.5, dropShadowFilter:{color:0x000000, alpha:1, blurX:5, blurY:5, strength:0.8, distance:2}}), i*.01);
                   
                    addChild(boxTxt);
                    }
    function tweenText(boxTxt) {
                   boxTxt.randomLetter_txt.text = getRandomLetter();
                    } 

    and got this error repeated:

    RangeError: Error #1125: The index 0 is out of range 0.
                    at RandomLetter_fla::MainTimeline/getRandomLetter()
                    at RandomLetter_fla::MainTimeline/tweenText()
                    at Function/http://adobe.com/AS3/2006/builtin::apply()
                    at com.greensock::TweenMax/renderTime()
                    at com.greensock.core::SimpleTimeline/renderTime()
                    at com.greensock::TweenLite$/updateAll()

    Attached is an image of the swf:

     

     

                                 

    post-17217-0-91742500-1384528921_thumb.jpg

  5. Hello, this is the best site since sliced-bread!

    I'm new to the site and was drawn to it from a youtube video that had GreenStock as an import.

     

    Anyway, I this tutorial https://www.youtube.com/watch?v=DUYFGXAtgqc and modified the code to place random Letters in the boxes  with dynamic text. (the link above also has source file.)

     

    the code:

    import com.greensock.*;
    
    /** Alphabet collection */
    var alphabet:Vector.<String>;
    
    /** Reset alphabet */
    function reset():void
    {
       alphabet = new <String>[ "A", "B", "C", "D", "E", "F", "G",
                                "H", "I", "J", "K", "L", "M", "N",
                                "O", "P", "Q", "R", "S", "T", "U",
                                 "V", "W", "X", "Y", "Z" ];
                                                                                                  
    }
    
    /** Get random letter from alphabet */
    function getRandomLetter():String
    {
        return (alphabet.splice(int(Math.random() *
                                    alphabet.length), 1)[0]);
    }
    
    /** Shuffle alphabet collection */
    function shuffleAlphabet():Vector.<String>
    {
        var alphabetShuffled:Vector.<String> = new Vector.<String>();
    
        while (alphabet.length > 0)
        {
            alphabetShuffled.push(getRandomLetter());
        }
    
        return alphabetShuffled;
    }
    
    
    // get a random letter:
    reset();
    var randomLetter:String = getRandomLetter();
    
    trace("Can you find the letter: " + randomLetter + "?");
    
    // display entire alpha shuffled:
    reset();
    trace(shuffleAlphabet());
    
    
    
    var numBoxes:Number = 160;
    
    var tl:TimelineMax = new TimelineMax({paused:true, onReverseComplete:playAgain});
    
    for(var i:uint = 0; i < numBoxes; i++){
                    var boxTxt:BoxTxt = new BoxTxt();
                    boxTxt.x = 1200/numBoxes*i
                    boxTxt.y = 800;
                    boxTxt.alpha = 0;
                   
                   
                    var alphabetShuffled:Vector.<String> = new Vector.<String>();
        while (alphabet.length > 0)
        {
            alphabetShuffled.push(getRandomLetter());
            var randomLetter2:String = getRandomLetter();
            boxTxt.randomLetter_txt.text = "" + randomLetter2;
        }
                   
                   
                   
                    TweenMax.to(boxTxt.solid_mc, 0, {tint:Math.random()*0xffffff})
                    tl.insert(TweenMax.to(boxTxt, 1, {x:Math.random()*1200, y:Math.random()*800, rotationY:360, onComplete:deBlur, onCompleteParams:[boxTxt]}), i*.01);
                    tl.insert(TweenMax.to(boxTxt, .1, {alpha:0.5, dropShadowFilter:{color:0x000000, alpha:1, blurX:5, blurY:5, strength:0.8, distance:2}}), i*.01);
                   
                    addChild(boxTxt);
                    }

    I was able to the random text to appear in each box, but only random at run-time. each character was the same.

    Is there a way to get each box to display a different letter in each box in the same way the color is randomized using TweenMax.to. ?

     

    You help is greatly appreciated.

     

    hmm, this site would not allow me to upload the .fla file, so basically all you need is a MC in the library named "boxTxt" and within that dynamicText named "randomLetter_txt" over a graphics named "solid_mc"

     

    :)

×
×
  • Create New...