Property of greensock TweenMax aboard animate

I'm trying to change the color of my symbol using TweeMax, but it does not work for me. All other properties work and are tweend correctly except the color. Any ideas? Here is my code:

() yepnope

{

Nope:]

"greensock/EaselPlugin.min.js,"

"greensock/plugins/ColorPropsPlugin.min.js,"

"greensock/plugins/CSSPlugin.min.js,"

"greensock/easing/EasePack.min.js,"

"greensock/TweenMax.min.js,"

],

full: init

}

);

function init () {}

var Rectangle = sym.getSymbol("Rectangle").getSymbolElement ();

{Rectangle.bind ("MouseOver", Function ()}

TweenMax.to (Rectangle, 1, {left: "100px +=", color: '0 x 938461', opacity: 0.7, ease:Bounce.easeOut});})

});

}

First of all, I must just say that Jack Doyle and GreenSock team are extreme superheroes. I use their library greensock for many years in Flash (I need to renew my membership Club GreenSock!) and it now used intensively to projects of html (with the standard html, Edge and html5 canvas via EaselJS). That's all just great.

Peter-backgroundColor does not work on a side of edge, it must be applied to a shape brute div (I think this has something to do with treated Edge how the symbol divs, behind the scenes).

Here is an example of work, where I separated the tweens, so that a Tween animates the symbol of the mother, and another interpolation anime the backgroundColor of the shape of the child prop. It is a workaround, but it works... and now that I think about it, at this point, you can also apply all your preteens to the purpose of "RectangleShape', rather than break them up in two separate tweens - but I assume that the bottom would still be relevant if you want to more directly control the positioning of the parent symbol.

And to answer your other q: you cannot tween backgroundColor of a parent symbol that contains the nested children, you have to interpolate individually the backgroundColor of each nested child prop.

Example:

www.timjaramillo.com/code/Edge/gsap_color_symbol

Source:

www.timjaramillo.com/code/Edge/_source/gsap_color_symbol.zip

Code Stage.compositionReady:

() yepnope

{

Nope:]

"greensock/TweenMax.min.js,"

"greensock/easing/EasePack.min.js,"

"greensock/plugins/CSSPlugin.min.js,"

'greensock/plugins/ColorPropsPlugin.min.js '.

],

full: init

}

);

When yepnope has loaded everything run init();

function init () {}

var RectangleSymbol = sym.$("RectangleSymbol");

var RectangleShape = sym.getSymbol("RectangleSymbol").$("RectangleShape");

{RectangleSymbol.bind ("mouseover", function ()}

TweenMax.to (RectangleSymbol, 1, {left: "100px +=", opacity: 0.7, ease:Bounce.easeOut});})

TweenMax.to (RectangleShape, 1, {backgroundColor: "#938461", ease:Bounce.easeOut});})

});

}

Tags: Edge Animate

Similar Questions

  • GreenSock TweenMax

    Hi all

    Thinking about the use/implementation GreenSocks TweenMax, wonder if it is a value of a study or not ;)
    All users experience good or bad would be more welcome.

    Kind regards

    Boxing boom

    Hi all

    Thank you all, I appreciate your comments.

    Kind regards

    Boxing boom

  • Easing in CC function animate like he was aboard animate

    Hi all!

    Onboard, animate, it was so easy to add ease in/out effects to any motion on the timeline. I just selected the desired movement and choose the easing function from the list. I don't find this function in the new version of CC to animate.

    I don't know GSAP, but I do not use it, because it's so tedious to manually add the easing function on each and every keyframe where I want to use a flexible movement.

    Is there a faster way to add easing in CC animate?

    Thank you in advance,

    George

    If you are a classic Tween you can vary the easing in the properties panel, or even go and make a custom acceleration graph. Those who could give him bad performance at the reading, because it is more difficult to convert a complex curve into a series of tweens of Javascript.

    If you do a motion tween, you can double-click the duration in the timeline panel, and you will see the query editor. One of the elements in the query editor is a drop-down list to mitigate. Certain types of fancy quite relaxed in there, and you can make your own. You can tween any independent attribute of other attributes.

  • using the event keydown aboard animate (was: keydown event)

    I want to use the keydown event and I used this syntax that works very well:

    $(document) .one ('keydown', {Function

    If (e.which == 32) {}

    Alert ("Something");

    }

    })

    But I wonder why this syntax does not work:

    $("#Stage").on ('keydown', {Function

    If (e.which == 32) {}

    Alert ("Something");

    }

    })

    Thank you.

    KeyDown events are sent only to elements that can receive focus. Default divs do not receive focus. Setting the tabindex on a div property can lead to receive the focus. If you set the same on stage, it should work once the stage has the focus.

    DIA-

  • Create animation online aboard animate (was: convince Linie)

    Hallo,

    ICH habe eine question wie kann ich in edge animate eine Linie/path convince?

    ICH will be mehret Punkte miteinander verbinden, um ein Netzwerk zu create.

    Freue mich über eure Hilfe! :-)

    Here is an example with the canvas. The code is in compositionReady.

    path with canvas.zip - Box

  • Implement a 360 pano aboard animate

    Hi people!

    Colleagues made one a pano Pano2Vr 360 and I need to directly implement onboard animate.

    The Html syntax to implement a Pano (via Krpano) is very simple:

    http://krpano.com/docu/HTML/#embedpano

    In my case:

    < body >

    < script src = "swfobject/swfkrpano.js" > < / script >

    < div id = "Pano" style = "height: 100%;" >

    < script >

    embedpano ({target: 'Pano', xml: "index.xml""});

    < /script >

    Everything is ok!

    But when I try to "translate" this edge code animate, I get this error (in console):

    TypeError: 'null' is not an object (assessment 'n.innerHTML = this.getSWFHTML ()')

    It's my EdgeCode (in CompositionReady):

    $("<link_rel='stylesheet'_type='text/css'_href='style.css'>").appendTo ("#Stage");

    () yepnope

    {

    Nope:]

    'swfkrpano.js '.

    ],

    full: init

    }

    );

    function init () {}

    embedpano ({target: "Pano", xml:"index.xml"});})

    }

    style code. CSS:

    {#Stage_Pano}

    Width: 100%;

    height: 100%;

    }

    Obviously, on the stage, I created an element in the shape of rectangle, called "Pano" (such as a Div)


    It seems to me that the parameter target: "Pano" in embedpano() function cannot recognize the Div "Pano" created in step edge? Maybe I have to translate the JQuery object in the Dom object? But how?

    Can anyone help?

    Here the complete project files:

    http://www.terredainventare.it/PanoEdge.zip

    Thank YOU in advance for your help!

    Davide

    Hey, Davide, try this:

    Pano var = sym.$("Pano");

    embedpano ({target: pano, xml:"index.xml"});})

    When I try this with your file, the error disappeared, but I don't see anything happen. Not sure if you are missing the file swf, or something else.

  • Is there audio events aboard animate 3.0? -Need to know when an audio file stops

    I'm working on a project where there is an audio playback button.  When the user clicks and audio playback, I want to show a version the button highlighted, but when the audio is finished, I want to emphasize to hide again.

    I did successfully using the library of buzz.js, but I try to use anime new native audio support, and I hope I can do the same thing.  With buzz, I would like to do this...

    ARM.bind ("pause", Function {}

    SYM.$("play_arm").Attr("src","images/play_btn.png");

    });

    ARM.bind ("playing", Function {}

    SYM.$("play_arm").Attr("src","images/stop_btn.png");

    });

    In this case, 'arms' is a variable that contains the audio, and I'm in the binder to the 'pause' and 'pay' events thrown by buzz.

    This syntax does not work for the audio native, so I wonder if there is another way to do this, or if there is no usable event.

    Any suggestions will be greatly appreciated.  Thank you!

    Fred

    I have it.

    Instead of link the action to the event, you add an event listener. Then...

    ARM.bind ("pause", Function {}

    SYM.$("play_arm").Attr("src","images/play_btn.png");

    });

    becomes

    arm.addEventListener ('complete', function() {}

    ...

    });

    You will also notice that I used "completed" instead of "pause".  My audio files are playing throughout of my current project, so 'done' is the best event.  'Break' also triggered at the end, then, really, that you can use.

    Hope this helps someone who has the same problem.  Thank you!

    Fred

  • How can I get video mp4 for playing the edge animate .oam on page Muse?

    Ok.  I'm pulling my hair out here...

    I am just placing a file of .oam edge animate with video on a page of Muse. The .oam contains a simple icon (that grows and shrinks slightly in a loop to draw attention) that, when clicked (event "on click") made a video .mp4 appear and start playing. Then the video disappears at the end, leaving the new icon (no controls - it just plays and goes when it's done).

    The animation/video playback works fine in edge animate and animate preview of edge browser but when I place the .oam file in my page of muse, the video does not play. I tried the same file without the event 'on click' where the video plays essentially on its own after a second aboard animate and edge Preview in the browser and even once, it does not read in Muse.

    It's embarrassing and I don't know how to solve the problem.

    Does anyone have any suggestions? My .oam file contains a .mp4 file a.webm file, although this will be part of a stand-alone Museum Kiosk and therefore does not need compatibility .webm.

    I'd appreciate any suggestions really.

    I thank very you much in advance!

    Mason

    HA!

    Doggone it! Somehow, I knew that it would work very well for someone else. This seems to be how these things go, isn't it? Exciting video, huh?

    In any case, I use Safari. I tried the image displayed in preview in the preview of the Muse and then tried in "Preview in browser" and it did not work for me. I just downloaded Chrome and will try to image previewed in there. Perhaps that will work.

    Holy crap!  I literally just released the entire HTML for the site of the Muse and opened it in Safari from there and it worked like a champ!  A problem with the perhaps "Preview in browser"?

    Well, color me happy! Perplexed but happy!

  • TypeError: Error #1009: cannot access a property or method of a null object reference.      at Visualmus

    I used the timeline and code on this project, but when I play the movie, this error keeps showing up on upward. Does anyone know how to get rid of this?

    Also, I have problems of synchronization of music, how to synchronize it so that it matches the film?

    Thank you!!!

    Here is my code

    import com.greensock.TweenMax;
    com.greensock.easing import. *;
    fscommand ("fullscreen", "true");

    var s:Sound = new Sound (new URLRequest("faye.mp3"));
    s.Play (0, 1000);

    var ba: ByteArray = new ByteArray();

    addEventListener (Event.ENTER_FRAME, loop);

    function loop(e:Event):void
    {

    SoundMixer.computeSpectrum (ba, true);
    var num:Number = ba.readFloat () * 900;
    addEventListener (Event.ENTER_FRAME, loop);

    head_mc. scaleX = sc.leftPeak * 1000
    monster_mc. scaleY = sc.rightPeak * 400.

    If {(num < 100)
    monster_mc. Alpha = 100;
    TweenMax.to (monster_mc, 2, {scaleX:num / 100, scaleY: number/100, autoAlpha: 0, ease:Elastic.easeOut});})
    TweenMax.to (head_mc, 1, {y: "-3", autoAlpha: 50, ease:Elastic.easeOut});})

    } ElseIf (num > 500) {}
    head_mc. ScaleX = num/1200;
    monster_mc. ScaleY = num/1200;
    doll_mc.y = Math.random () * NB;
    TweenMax.to (doll_mc,.5, {y: "40", yoyo: true, autoAlpha: 0, ease:Elastic.easeOut});})
    TweenMax.to (cloud, 1 [{time: 1, delay: 1.}, {time: 0.8, autoAlpha: 0}]);
    TweenMax.to (clip_mc, 5, {alpha: 0.5, x: 120, ease:Back.easeOut, delay: 2, onComplete:onFinishTween, onCompleteParams: [5, clip_mc]});

    mush_btn.addEventListener (MouseEvent.MOUSE_DOWN, Mush);

    function mush(evt:MouseEvent):void {}
    group_mc. ScaleX +=. 1000;
    group_mc. ScaleY +=. 500;

    mush_btn.addEventListener (MouseEvent.MOUSE_UP, dropsFull);
    //
    function dropsFull(evt:MouseEvent):void {}
    group_mc.gotoAndStop (2);
    //}
    //


    }


    }
    trace (num);
    }

    Full screen
    stage.displayState = StageDisplayState.FULL_SCREEN;

    Hide the mouse

    import flash.ui.Mouse;
    Mouse.Hide ();

    ///////////////////////////////


    Load sound

    var height: Sound = new Sound (new URLRequest ("faye.mp3"));
    var sc:SoundChannel = tune.play ();


    Enter appeal event framework

    stage.addEventListener (Event.ENTER_FRAME, onEnter);
    function onEnter(evt:Event) {}

    var elapsedNum:Number = sc.position/1000;



    Calculate sound position each image

    LeftPeak variable
    var left: Number = sc.leftPeak * 20;

    RightPeak variable
    var right: Number = sc.rightPeak * 20;

    Main logic of animation based on the position of the song


    If (elapsedNum > = 1) {}
    var transform1:SoundTransform = new SoundTransform (0.1, 0);
    star_mc. SoundTransform = transform1;

    star_mc.x = Math.Random () * 1000;
    star1_mc.y = Math.Random () * 400;
    star2_mc.x = Math.Random () * 1000;
    star3_mc.y = Math.Random () * 1000;
    star4_mc.y = Math.Random () * 600;
    star5_mc.y = Math.Random () * 1000;
    star6_mc.y = Math.Random () * 1000;
    star7_mc.y = Math.Random () * 1000;
    star8_mc.y = Math.Random () * 1000;
    star9_mc.y = Math.Random () * 1000;
    star10_mc.y = Math.Random () * 800;
    star11_mc.y = Math.Random () * 1000;
    star12_mc.y = Math.Random () * 1000;
    star13_mc.y = Math.Random () * 1000;
    star14_mc.y = Math.Random () * 1000;
    star18_mc.y = Math.Random () * 500;

    } else if (elapsedNum > = 16 & & elapsedNum < 31) {}

    star11_mc. ScaleX = left * 2;
    star5_mc.x = 500;
    star6_mc.y = 400;
    star7_mc.x = 500;
    star8_mc.y = 400;

    }

    }

    1009 error indicates that one of the objects targeted by your code are out of reach.  This may mean that the object...

    n ' is not in the display list
    n ' is not have an instance name (or the name of the instance is misspelled)
    n ' is not in the frame where this code tries to talk to her
    -is animated in place, but is not assigned the name of the instances of each keyframe for her
    -is one of the two or more keyframes consecutive same objects with different names assigned.
     
    If you go to your section to publish the Flash settings and select permit debugging option, your error message should have a suite of line number the number of the frame that will help you to isolate the object that is involved.

  • I need help with a radiation filter

    Hi guys,.

    I have a screen with a background and five different letter (objects) on it.

    I need these letters (C, O, etc) to be turned on in and out all the time, because they will be "interactive"... objects

    Now, apply the filter to make them glow, is easy... but how do I get it out and in (as when you play bejeweled and you don t know what to do and the game gives you a clue)

    I'd appreciate any help on this.

    Thank you very much

    Keep a radiation persistent for each filter (or re-using foreach) is a good idea. Here is a complete example, you can paste it into a new--> Document AS3 in Flash to show you how to use the Tween class integrated events:

    import flash.filters.GlowFilter;

    Import fl.transitions.Tween;

    Import fl.transitions.easing.Regular;

    Import fl.transitions.TweenEvent;

    import flash.text.TextField;

    import flash.text.TextFormat;

    import flash.text.AntiAliasType;

    Place the TextField to glow

    var letters_txt:TextField = new TextField();

    letters_txt. Width = 200;

    letters_txt. Height = 75;

    letters_txt.x = letters_txt.y = 100;

    letters_txt.antiAliasType = AntiAliasType.ADVANCED;

    letters_txt. Text = "GLOW."

    letters_txt.setTextFormat (new TextFormat("Arial",50,0x0,true));

    addChild (letters_txt);

    object to store the values of interpolation

    var glowProperties:Object = new Object();

    glowProperties.strength = 2;

    glowProperties.blurRadius = 20;

    glowProperties.alpha = 1;

    glowProperties.position = 100; only one percent, from 0 to 100

    Add a glow

    letters_txt.filters = [new GlowFilter(0xFF0000,1,20,20,2,1,false,false)];

    more than 2 seconds to animate the 'position' property in the

    object glowProperties from 100 to 0, then yoyo

    var myTween:Tween = new Tween (glowProperties, "position", Regular.easeInOut, 0, 100, 1, true);

    each change, handle it myself

    myTween.addEventListener (TweenEvent.MOTION_CHANGE, onTweenChange);

    end of the tween, the inversion and continue

    myTween.addEventListener (TweenEvent.MOTION_FINISH, onTweenFinish);

    manage the update properties based on position (0-100)

    function onTweenChange(e:TweenEvent):void

    {

    Calc percent of the effect to apply

    var pct:Number = glowProperties.position / 100;

    multiply the values of each property once the percentage of position

    var str:Number = glowProperties.strength * pct;

    var rad:Number = glowProperties.blurRadius * pct;

    var al: Number = glowProperties.alpha * pct;

    reapply the filter

    letters_txt.filters = [new GlowFilter (0xFF0000, al, rad, rad, str, 1, false, false)];

    }

    reverse and try again

    function onTweenFinish(e:TweenEvent):void

    {

    myTween.yoyo ();

    myTween.start ();

    }

    Here, I use an object to track the properties I am interested in the animation. Animate a property of this object, the 'position' property She is animated between 0 and 100, more than a second. I am attentive to the TweenEvent.MOTION_CHANGE so I can use the percentage position. I simply multiply each adjustment of the effect of this percentage to change the effect over time.

    When the Tween is finished TweenEvent.MOTION_FINISH triggers and I run the yoyo() function to reverse the change in the 'position' property so it goes back from 0 to 100, making a back loop. 100-0, then 0-100, rinse repeat.

    This can certainly be optimized by directly assigning a GlowFilter itself which is applied to several objects rather than recreating a new GlowFilter each change. You get the general idea, however.

    TweenLite is useful here as well because it can change many properties at once instead of one as the built in Tween class. Simply run the finished, reverse() method then restart() interpolation. Here are a few examples start-up. Also, if you don't mind the stature, TweenMax has the same syntax but supports the properties of 'repeat' and 'yoyo' to make your glow all literally take one line of code.

    Example of TweenMax (with anon function though):

    import flash.filters.GlowFilter;

    import flash.text.TextField;

    import flash.text.TextFormat;

    import flash.text.AntiAliasType;

    import com.greensock.TweenMax;

    import com.greensock.easing.Quad;

    Place the TextField to glow

    var letters_txt:TextField = new TextField();

    letters_txt. Width = 200;

    letters_txt. Height = 75;

    letters_txt.x = letters_txt.y = 100;

    letters_txt.antiAliasType = AntiAliasType.ADVANCED;

    letters_txt. Text = "GLOW."

    letters_txt.setTextFormat (new TextFormat("Arial",50,0x0,true));

    addChild (letters_txt);

    generate the radiation filter, apply

    var glowF:GlowFilter = new GlowFilter(0xFF0000,1,20,20,2,1,false,false);

    letters_txt.filters = [glowF];

    animate with tweenmax

    TweenMax.to (glowF, 1, {alpha: 0})

    blurX:0,

    blurY:0,

    power: 0.

    Ease:quad.easeInOut,

    yoyo: true,

    repeat:-1.

    onUpdate:function (): void {letters_txt.filters = [glowF] ;}

    });

    On a modern computer ~ 5 years old or more recent it is extremely easy to do. If you're programming device you really want to consider a different approach (such as fade in a version already glowing text on the non-incandescent text to 'fake it').

  • Banner ad design text outside the dimensions of movie... Why?

    Morning!

    I've created a banner ad which works fine when I test it in flash.  I then put inside an another flash animation in which it is loaded as an external swf, my wallet and it it loads and work the 1st line of animation code and I can see the text which is pending (outside the Visual dimension of the banner)

    I also get this error... What is happening?

    ReferenceError: Error #1069: cachedOrphan property not found on com.greensock.TweenMax and there is no default value.

    to com.greensock::TimelineLite/addChild()

    to com.greensock::TimelineLite/insert()

    to com.greensock::TimelineLite/insertMultiple()

    So of course when I embed this file in my HTML Fireworks the same thing.

    Can someone help me?

    Thanks in advance

    When you load a swf into another swf and the loaded file loses the main swf defines the stage/bottom his.  If you want to limit the amount of the loaded swf file is displayed, you can use a mask for her.

    Regarding who will error message, it may have to do to try to animate an element (cachedOrphan?), which does not yet exist.

  • Library swf with does not perform the actions

    I have an actionScript animation film simple (using Greensock TweenMax) after export works fine when I open the .swf file obtained on its own (double click on my Mac finder).  My film has 2 frames, frame 1 sets up the interpolation on the object function in my film, frame 2 performs the function and stops.  As I said, if I open the exported .swf file or preview in a html browser, I see the desired animation effect.

    However, when I include the swf exported in another project file (using import to library) and drop it in my main script - I don't get the animation that I see in my standalone swf file.  I tried to call the file directly to play and notheing happens.  When I opened this symbol of swf (double clicking) after putting on the main timeline, I see 2 managers, but only in the original file symbiols graphics are in these frameworks (no action).

    I test the same goal using an exported swf of a film by the animation timeline (classic Tween), and it worked fine).

    What Miss me?  Is it possible to take advantage of a file to swf actionscript animation in other films?  I want to do so that I can create a bunch of stand alone animations I load in dynamically and play without chronology animate each one.  Any help GREATLY appreciated, thank you very much!

    Yes, if it's an AS3 file you can use the Loader class.

    If you want the movie to be physically in the other alternative file would be to copy the script of the film to a movieclip in the other file.

  • Unable to access MovieClips and functions in a loaded SWF

    Hello world

    I'm just trying access anything whatsoever within the loaded SWF and all I get is 'null '.

    I have the code in the SWF parent who must tell the SWF movieclip child what to do, but nothing works. It's a piee of cake into AS2, and I can't seem to get anything of crossover in AS3.

    Here is my code:

    import com.greensock.TweenMax;
    import flash.display.MovieClip;
    
    var myLoader:Loader = new Loader();
    var url:URLRequest = new URLRequest("SWCS_S3_500x250_exp_panel_2.swf"); // in this case both SWFs are in the same folder 
    myLoader.load(url);  // load the SWF file
    panel2.addChild(myLoader);   // add that instance to the display list, adding it to the Stage at 0,0
      
    panel2 = myLoader.content as MovieClip;
    
    photo_about.alpha = 0;
    photo_downloads.alpha = 0;
    
    //panel2.content_about.alpha = 0;
    //panel2.content_downloads.alpha = 0;
    
    function closeSection():void
    {
              panel2.controlsMC.forcePause();
    
              TweenMax.to(photo_about, .5, {alpha:0});
              TweenMax.to(photo_downloads, .5, {alpha:0});
              TweenMax.to(photo_home, .5, {alpha:0});
      
              TweenMax.to(panel2.content_about, .5, {alpha:0});
              TweenMax.to(panel2.content_downloads, .5, {alpha:0});
      
              TweenMax.to(panel2.controlsMC, .5, {autoAlpha:0});
              TweenMax.to(panel2.content_home, .5, {alpha:0});
    }
    
    

    Panel2 traces null and all clips loaded in draw property undefined errors.

    Can someone please tell me what I'm doing wrong? I would be happy to see what Miss me and feel like this should be a piece of cake.

    Thanks for any help!

    You do not add the content of the scene to 0.0, you add it to panel2 to 0,0.  Then you take panel2 and assign to something that probably does not exist at the time wherever you set it.  You must wait until the loader load before trying to do something with its content, otherwise it has no content (null).  Similarly, you can not control anything in the loaded swf file, until it is fully charged.  So to assign an event listener for the property contentLoaderInfo the loader to determine when loading is complete, and have the event handler works deal from interacting with it.

    var myLoader:Loader = new Loader();

    var url: URLRequest = new URLRequest ("SWCS_S3_500x250_exp_panel_2.swf");

    myLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, processLoadedSWF);

    myLoader.load (url);

    function processLoadedSWF(evt:Event):void {}

    deal with the swf loaded here

    but you do not want to be assigned to the panel2 object that contains the charger

    }

    With regard to the control of anything anyone inside of the swf you are loading, is an AS1/2 or an AS3 swf?

  • How do I know what thumb is click and store this valuse for later use

    Hi guys I have build an here's my code and xml driven image gallery

    package com.elements
    {
    import flash.display.MovieClip;
    import the left arrow;
    import the right arrow;
    import flash.display.Sprite;
    import flash.net.URLLoader;
    import flash.events.Event;
    import flash.net.URLRequest;
    import flash.display.Loader;
    to import flash.events.ProgressEvent;
    import flash.events.IOErrorEvent;
    import com.elements.PreloaderObject;
    import com.greensock.TweenMax;
    import flash.display.DisplayObject;
    import flash.events.MouseEvent;
    Import 12345678910111213import;

    SerializableAttribute public class Scrollercontainer extends MovieClip
    {
    private var int index;
    private var padding: Number = 20;
    private var leftArrow:LeftArrow;
    private var rightArrow:RightArrow;
    private var scrollerBg:Sprite;
    private var scrollerMask:Sprite;
    private var xmlPath:String = "xml/scroller.xml.
    private var xmlLoader:URLLoader;
    private var preloader: PreloaderObject;
    private var indexTracker:Array;
    public static var bgImage:Array;
    public static var thumbImage:Array;
    public static var labelArray:Array;
    private var xmlData:XML;
    private var vx:Number;
    public void Scrollercontainer()
    {
    addEventListener (Event.ADDED_TO_STAGE, onAddedtoStageHandeler, false, 0, true);
    this.addEventListener (MouseEvent.MOUSE_OVER, scrollThumbNail);
    }
    private void onAddedtoStageHandeler(evt:Event):void
    {
    scrollerBg = new Sprite();
    scrollerBg.graphics.beginFill (0 x 000000, 1);
    scrollerBg.graphics.drawRect (0,0,865,78);
    scrollerBg.graphics.endFill ();
    addChild (scrollerBg);
    scrollerBg.x = 28;
    scrollerBg.y = 13;
    scrollerMask = new Sprite();
    scrollerMask.graphics.beginFill (0 x 000000, 1);
    scrollerMask.graphics.drawRect (0,0,865,78);
    scrollerMask.graphics.endFill ();
    addChild (scrollerMask);
    scrollerMask.x = 28;
    scrollerMask.y = 13;
    scrollerBg.mask = scrollerMask;
    left arrow = new LeftArrow();
    leftArrow.x = 14;
    leftArrow.y = 44;
    leftArrow.buttonMode = true;
    addChild (leftArrow);
    right arrow = new RightArrow();
    rightArrow.x = 901;
    rightArrow.y = 44;
    rightArrow.buttonMode = true;
    addChild (rightArrow);
    lodXMLinit();
    }
    private function lodXMLinit (): void
    {
    bgImage = new Array();
    thumbImage = new Array();
    labelArray = new Array();
    xmlLoader = new URLLoader();
    xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded);
    xmlLoader.load (new URLRequest (xmlPath));
    Preloader = new PreloaderObject();
    preloader.buildPreloader ();
    }
    private void xmlLoaded(evt:Event):void
    {
    xmlData = new XML (evt.target.data);
    var xmlList:XMLList = xmlData.slide;
    var point: XML;
    trace (xmlList.ToXmlString ());
    for each (xmlList)
    {
    bgImage.push (item.image);
    thumbImage.push (item.thumbImage);
    labelArray.push (item.label);
    }
    trace(thumbImage[1]);
    buildThumbScroller();
    }
    private function buildThumbScroller (): void
    {
    indexTracker = new Array();
    for (var i: int = 0; i < thumbImage.length; i ++)
    {
    var thumbBackground:MovieClip = new MovieClip();
    var thumbImgeBackground:Sprite = new Sprite();
    thumbImgeBackground.graphics.beginFill(0xffffff,1);
    thumbImgeBackground.graphics.drawRect (0,0,100,78);
    thumbImgeBackground.graphics.endFill ();
    thumbBackground.addChild (thumbImgeBackground);
    thumbBackground.x = (100 + padding) * i;
    thumbBackground.src = thumbImage [i];
    thumbBackground.buttonMode = true;
    var preloader: PreloaderObject = new PreloaderObject();
    Preloader.Name = String (i);
    preloader.buildPreloader ();
    var imageContainer:Sprite = new Sprite();
    var thldr:Loader = new Loader();
    thldr.contentLoaderInfo.addEventListener (Event.OPEN, pairs loadStarted);
    thldr.contentLoaderInfo.addEventListener (Event.COMPLETE, imageLoaded);
    thldr.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, showProgress);
    thldr.contentLoaderInfo.addEventListener (IOErrorEvent.IO_ERROR, onError);
    thldr. Load (new URLRequest (thumbBackground.src));
    imageContainer.addChild (thldr);
    thumbBackground.addChild (imageContainer);
    thumbBackground.alpha = 0;
    thumbBackground.addEventListener (MouseEvent.CLICK, showBigImage);
    indexTracker.push (thumbBackground);
    scrollerBg.addChild (thumbBackground);
    }
    for (var j: int = 0; j < indexTracker.length; j ++)
    {
    indexTracker [j] .buttonMode = true;
    .indexs indexTracker [j] = j;
    indexTracker [j] .addEventListener (MouseEvent.CLICK, showBigImage);
    }

    }
    private void loadStarted(evt:Event):void
    {

    scrollerBg.addChild (preloader);
    Preloader.y = scrollerBg.height/2;
    }
    private void imageLoaded(evt:Event):void
    {
    resizeThumbNail (evt.target.loader.parent, 100, 57, true, true, false);
    TweenMax.to(evt.target.loader.parent.parent,0.5,{alpha:1});)
    }
    private void showProgress(evt:ProgressEvent):void
    {

    var p: Number = (1.0 / evt.bytesTotal) * evt.bytesLoaded;

    If (p == 1)
    {
    If (preloader.stage)
    {
    scrollerBg.removeChild (preloader);
    }
    this.removeChild (preloader);
    }
    on the other
    {
    preloader.loadBar.width = scrollerMask.width * %;
    }

    }
    private void onError(evt:IOErrorEvent):void
    {

    }
    private void resizeThumbNail(mc:DisplayObject,maxWidth:Number,maxHeight:Number,constrainProportions:Boolean=true,horCenAlign:Boolean=true,verticalCentralAlign:Boolean_=_true):void
    {
    MC. Height = maxHeight;
    MC. Width = maxWidth;
    If (constrainProportions)
    {

    }
    If (horCenAlign)
    {
    MC.x = (maxWidth - mc.width) / 2;
    }
    If (verticalCentralAlign)
    {
    MC.y = (maxHeight - mc.height) / 2;
    }
    }
    private void scrollThumbNail(evt:MouseEvent):void
    {
    scrollerBg.addEventListener (Event.ENTER_FRAME, onEnterFrameHandeler);
    scrollerBg.addEventListener (MouseEvent.MOUSE_OUT, stopScrolling);
    }
    private void onEnterFrameHandeler(evt:Event):void
    {
    If (mouseY > scrollerMask.y & & mouseY < scrollerMask.height)
    {
    If (mouseX > 0 & & mouseX < scrollerMask.width/2)
    {
    VX =-(mouseX-(scrollerMask.width/2-rembourrage * 2)) / 8;
    }
    ElseIf (mouseX > scrollerMask.width/2 & & mouseX < scrollerMask.width)
    {
    VX =-(mouseX-(scrollerMask.width/2-rembourrage * 2)) / 8;
    }
    scrollerBg.x += vx;
    }
    if(scrollerBg.x > scrollerMask.x)
    {
    scrollerBg.x = scrollerMask.x + padding;
    }
    If (scrollerBg.x <-(scrollerBg.width-scrollerMask.width))
    {
    scrollerBg.x =-(scrollerBg.width-scrollerMask.width);
    }
    }
    private void stopScrolling(evt:MouseEvent):void
    {
    scrollerBg.removeEventListener (Event.ENTER_FRAME, onEnterFrameHandeler);
    }
    private void showBigImage(evt:MouseEvent):void
    {
    = index evt.target.indexs;
    var bgImageloader:Loader = new Loader();
    bgImageloader.contentLoaderInfo.addEventListener (Event.COMPLETE, bgimageLoaded);
    bgImageloader.contentLoaderInfo.addEventListener (Event.OPEN, startLoading);
    bgImageloader.contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, showProgressBg);
    bgImageloader.load (new URLRequest (bgImage [index]));

    }
    private void startLoading(evt:Event):void
    {
    this.parent.addChild (preloader);
    }
    private void showProgressBg(evt:ProgressEvent):void
    {
    var p: Number = (1.0 / evt.bytesTotal) * evt.bytesLoaded;

    If (p = 100)
    {
    If (preloader.stage)
    {
    this.removeChild (preloader);
    }
    }
    on the other
    {
    preloader.loadBar.width = % stage.stageWidth*;
    }
    }
    private void bgimageLoaded(evt:Event):void
    {
    var bg:Bitmap = evt.target.content as Bitmap;
    BG. Smoothing = true;
    BG.alpha = 0;
    this.parent.parent.addChildAt(bg,0);
    TweenMax.to(bg,1,{alpha:1});)
    }
    }

    }

    but when I got an error

    If please help me track the index and therefore I have can show image basically appropriate when one is clicked thum

    ReferenceError: Error #1069: property not found markings on flash.display.Loader and there is no default value.
    at com.elements::Scrollercontainer/showBigImage() [E:\madhu\xmldrivenslideshow\com\elements\S crollercontainer.as:220]

    thumbBackground.alpha = 0;
    thumbBackground.addEventListener (MouseEvent.CLICK, showBigImage);
    indexTracker.push (thumbBackground);
    scrollerBg.addChild (thumbBackground);
    }
    for (var j: int = 0; j< indextracker.length;="">
    {
    indexTracker [j] .buttonMode = true;
          .Indexs indexTracker [j] = j;
    indexTracker [j] .addEventListener (MouseEvent.CLICK, showBigImage);
    }

    Why not just put this code in the first loop for? So you're just setting properties of thumbBackground...:

    thumbBackground.alpha = 0;
    thumbBackground.addEventListener (MouseEvent.CLICK, showBigImage);

    thumbBackground.buttonMode = true;

    thumbBackground.indexs = i;

    indexTracker.push (thumbBackground);
    scrollerBg.addChild (thumbBackground);
    }

    And then, in showBigImage use currentTarget:

    private void showBigImage(evt:MouseEvent):void
    {
               index = evt.currentTarget.indexs;

  • cachedOrphan error #1069

    I am trying to load an external swf into a movie and can not for the life of me what I am doing wrong.   Anyone who is familiar with that? Thanks in advance!

    Barbara

    ReferenceError: Error #1069: cachedOrphan property not found on com.greensock.TweenMax and there is no default value.
    at com.greensock::TimelineLite/addChild()
    at com.greensock::TimelineLite/insert()
    at com.greensock::TimelineLite/insertMultiple()
    at nutroBanner_fla::MainTimeline/frame1()

    by greensock this is caused by using mixed versions of its files:

    http://forums.greensock.com/viewtopic.php?f=1&t=3031

Maybe you are looking for