Jump to content
GreenSock

mkg14

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by mkg14

  1. Hello,

     

    I am trying to rotate a 2D star three or four consecutive times on its y-axis, and while the rotation is happening the star is moving away from the viewer in space. Essentially the star is larger as the animation begins because it's closer to the viewer, and as it rotates it gets smaller because it's moving away from the viewer in space. Hopefully this makes sense.

     

    In terms of creating the rotation effect, I've tried the ShortRotationPlugin, but that causes the star looks a little warped as it rotates.

     

    Any help would be appreciated. Thanks in advance!

  2. Thank you Carl! That worked perfectly. Thanks as well for the link to other approaches.

     

    In terms of ending the mouse event (moveIt), if the user interacts with the object I have figured out how to end it after a certain amount of time and move on to the final screen of the animation. Say, however, that the user does not interact with the object at all, but I still want to end the mouse event after a certain amount of time and move on to the final screen. Not sure how to incorporate that into the coding. (Use a timer?) Can you help? I've attached my zipped flash file. It looks super generic because I replaced the photos with simple graphic screens.

     

    testFile_gs.fla.zip

  3. Hello,

     

    Is there a way for the viewer to control an object with his mouse? First I want the object to enter the stage and stop. After the object stops I would like the viewer to be able to move it up and down on the y axis using his mouse.

     

    Any help would be appreciated!

  4. I'm really sorry about that!!! I'll stick to those guidelines in the future.

     

    Thank you for your help. That worked and I only had to make one addition: Everything but the panning image reset, so I had to add the following line of code under the note "//objects on stage" in order to reset the image back to its starting position:

     

    imageMC.x = 0;

     

    The animation works perfectly now. Thanks again!

  5. Hi Carl,

     

    I have the same question about adding a replay button, but I don't understand how to apply the sample code that you've given. The complete code for my animation is below. There is only one frame in the timeline with all of the animation being controlled by AS. I'm a beginner when it comes to AS3, so please excuse my clunky code as I'm sure there's a more streamlined way to write it :)

    //imports
    import flash.external.ExternalInterface;
    import flash.net.URLRequest;
    import flash.net.navigateToURL;
    import com.greensock.TweenLite;
    import com.greensock.loading.ImageLoader;
    import com.greensock.easing.Linear;
    
    //clicktag for invisible button
    function getBrowserName():String
            {
                var browser:String;
                //Uses external interface to reach out to browser and grab browser useragent info.
                var browserAgent:String = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
                //Determines brand of browser using a find index. If not found indexOf returns (-1).
                if(browserAgent != null && browserAgent.indexOf("Firefox")>= 0) {
                    browser = "Firefox";
                }
                else if(browserAgent != null && browserAgent.indexOf("Safari")>= 0){
                    browser = "Safari";
                }
                else if(browserAgent != null && browserAgent.indexOf("MSIE")>= 0){
                    browser = "IE";
                }
                else if(browserAgent != null && browserAgent.indexOf("Opera")>= 0){
                    browser = "Opera";
                }
                else {
                    browser = "Undefined";
                }
                return (browser);
            }
    
    function openWindow(url:String, target:String = '_blank', features:String=""):void
    {
        var WINDOW_OPEN_FUNCTION:String = "window.open";
        var myURL:URLRequest = new URLRequest(url);
        var browserName:String = getBrowserName();
        switch (browserName)
                    {
                        //If browser is Firefox, use ExternalInterface to call out to browser
                        //and launch window via browser's window.open method.
                        case "Firefox":
                            ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, target, features);
                           break;
                        //If IE,
                        case "IE":
                            ExternalInterface.call("function setWMWindow() {window.open('" + url + "', '"+target+"', '"+features+"');}");
                            break;
                        // If Safari or Opera or any other
                        case "Safari":
                            navigateToURL(myURL, target);
                            break;
                        case "Opera":
                            navigateToURL(myURL, target);
                            break;
                        default:
                            navigateToURL(myURL, target);
                            break;
                    }
    }
    
    function clickedb(e:MouseEvent):void { //function for SIPC
        var sURL: String;
        if ((sURL = root.loaderInfo.parameters.clickTag)) {
            openWindow(sURL);
        }
        //navigateToURL(new URLRequest("#"), "_blank");
    }
    
    thisBTN.addEventListener(MouseEvent.CLICK, clickedb);
    
    //objects on stage
    imageMC.alpha = 1;
    replayBtn.alpha = 0;
    ccLogo.alpha = 1;
    giftsTF.alpha = 0;
    tableTF.alpha = 0;
    bedroomTF.alpha = 0;
    bathTF.alpha = 0;
    everywhereTF.alpha = 0;
    finalLockup.alpha = 0;
    
    //begin animation: image begins panning from right to left while logo fades out and gifts type fades in
    TweenLite.to(imageMC, 13, {x:-1500, delay:1.5, ease:Linear.easeNone} );
    TweenLite.to(ccLogo, .5, {alpha:0, delay:2.5} );
    TweenLite.to(giftsTF, .5, {alpha:1, delay:2.8} );
    TweenLite.delayedCall(5.25, tweenGiftsOut);
    
    //gift type fades out and table type fades in
    function tweenGiftsOut()
    {
        TweenLite.to(giftsTF, .5, {alpha:0} );
        TweenLite.to(tableTF, .5, {alpha:1, delay:0.5} );
        TweenLite.delayedCall(3, tweenTableOut);
    }
    
    //table type fades out and bedroom type fades in
    function tweenTableOut()
    {
        TweenLite.to(tableTF, .5, {alpha:0} );
        TweenLite.to(bedroomTF, .5, {alpha:1} );
        TweenLite.delayedCall(2, tweenBedroomOut);
    }
    
    //bedroom type fades out and bath type fades in
    function tweenBedroomOut()
    {
        TweenLite.to(bedroomTF, .5, {alpha:0} );
        TweenLite.to(bathTF, .5, {alpha:1} );
        TweenLite.delayedCall(2, tweenBathOut);
    }
    
    //bath type fades out and everywhere type fades in
    function tweenBathOut()
    {
        TweenLite.to(bathTF, .5, {alpha:0} );
        TweenLite.to(everywhereTF, .5, {alpha:1} );
        TweenLite.delayedCall(2, tweenEverywhereOut);
    }
    
    //everywhere type fades out and final call to action lockup and replay button fade in
    function tweenEverywhereOut()
    {
        TweenLite.to(everywhereTF, .5, {alpha:0} );
        TweenLite.to(finalLockup, .5, {alpha:1} );
        TweenLite.to(replayBtn, .5, {alpha:1} );
    }
    
    //need to add the coding for a replay button (replayBtn) here, but not sure how to do it
×