Jump to content
Search Community

Steven P123

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by Steven P123

  1. Greetings,

     

    I have a number of clips set to autoAlpha:0, each on their own layer. I have set up a TimelineMax with pause, resume, and reverse buttons all on the stage. These work just fine.

     

    On each tweened clip, I want to set up buttons to pause the timeline (and popup a larger image). Unfortunately, when I put the button listener on the top level (not in a scene but at the top) of the project, I am greeted with the 1120 "undefined property" error. So, I put the listener on a layer within the child clip, and a trace function that works just fine. Unfortunately, I don't know how to reach the parent's TimelinMax instance. I don't even know if this is a child/parent relationship, truth be told.

     

    Unable to upload a mini fla (Error No file was selected for upload)

     

    Here is (I think) the relative code:

     

    top level:

    import com.greensock.*;
    import flash.events.MouseEvent;
    import com.greensock.easing.*;
    
    //create line
    var line:Shape = new Shape();
    addChild(line);
    
    //position mc at first point
    mc.alpha = 0; // calling lineDraw sets alpha '1' each time
    mc.x = mc_dot01_08_21_22.x;
    mc.y = mc_dot01_08_21_22.y;
    
    var tl:TimelineMax = new TimelineMax({paused:true,onUpdate:drawLine});
    var routeLegVar:Number = 5;
    var dotPopVar:Number = 0.5;
    var grpFadeVar:Number = 1;
    var repeatDlyVar:Number = routeLegVar - (2 * grpFadeVar);
    ////////////////////////////////////////////////
      tl.insert( TweenLite.to(mc, routeLegVar, {x:mc_dot02_07_10.x, y:mc_dot02_07_10.y, onComplete:functionLineClear}), "label_01");
    
      
    // dots
    tl.insert( TweenLite.to(mc_dot01_08_21_22, dotPopVar, {scaleX:2, scaleY:2, ease:Linear.easeNone}), "label_01");
    tl.insert( TweenLite.to(mc_dot02_07_10, dotPopVar, {scaleX:2, scaleY:2, ease:Linear.easeNone}), "label_02");
    
    // group fades
    tl.insert( TweenMax.to(mc_williamsburg, grpFadeVar, {autoAlpha:1, repeat:1, repeatDelay: repeatDlyVar, yoyo:true}), "label_01");
    
    ////////////////////////////////////////////////
    
    function drawLine():void
    {
    	line.graphics.lineTo(mc.x, mc.y);
    	mc.alpha = 1;
    }
    
    // buttons
    play_btn.addEventListener(MouseEvent.CLICK, playTl);
    pause_btn.addEventListener(MouseEvent.CLICK, pauseTl);
    resume_btn.addEventListener(MouseEvent.CLICK, resumeTl);
    reverse_btn.addEventListener(MouseEvent.CLICK, reverseTl);
    
    // 1120 error if placed here:
    // btnPop01mWash.addEventListener(MouseEvent.CLICK, pauseTl);
    
    // functions
    function pauseTl(e:MouseEvent):void {
    	tl.pause();
    }
    
    function resumeTl(e:MouseEvent):void {
    	tl.resume();
    }
    
    function reverseTl(e:MouseEvent):void {
    	tl.reverse();
    }
    
    function playTl(e:MouseEvent):void
    {
    	//kill existing line
    	line.graphics.clear();
    	
    	//start new line at first point
    	line.graphics.lineStyle(2, 0xFF0000, 1);  // width, color, opacity
    	line.graphics.moveTo(mc_dot01_08_21_22.x, mc_dot01_08_21_22.y);
    	
    	tl.restart();
    
    }
    
    function functionLineClear(){
    	//trace('functionLineClear called');
    	line.graphics.clear(); // kills all
    	line.graphics.lineStyle(2, 0xFF0000, 1);  // width, color, opacity
    	//line.graphics.moveTo(mc_dot02_07_10.x, mc_dot02_07_10.y);
    	line.graphics.moveTo(mc.x, mc.y);
    }
    ///////// set initial states
    
    mc_dot01_08_21_22.scaleX = mc_dot01_08_21_22.scaleY = 0;
    mc_dot02_07_10.scaleX = mc_dot02_07_10.scaleY = 0;
    
    
    // groups & singles alpha
    TweenLite.set(mc_williamsburg, {autoAlpha:0});
    
    
    

    And in the 'mc_williamsburg' clip:

    // a button with instance name of btnPop01mWash is in this clip
    
    btnPop01mWash.addEventListener(MouseEvent.CLICK, pauseTl);
    
    // functions
    function pauseTl(e:MouseEvent):void {
    	//tl.pause(); // Does not pause the timeline defined in the top level
    	trace('pauseTl called from williamsburg'); // does in fact trace when the button is clicked
    }
    
    

    All items reside in the one file - it's a stand-alone deal.

     

    Thanks for any pointers, and best wishes,

    Steven

  2. Carl, thanks for taking the time to build that package for me.

     

    I downloaded the trial of CS6 and after successfully executing main.fla, I copied it to a different file (changing the document class as well) and commented the main.as so that just Child1 ran. this worked fine. Then I adjusted main.as so that it would play one of my animations which I had prepared by removing it's action script and placing it in widgetland.as (which was a copy of Child2.as with corrected class & function declarations).

     

    Unfortunately, I have an error returned over a property for a movie clip within my animation which is not scripted in any way:

    SWFLoader 'loader1' (Child1.swf) loaded
    ReferenceError: Error #1056: Cannot create property mc_name_rust on widgetland.
    	at flash.display::Sprite/constructChildren()
    	at flash.display::Sprite()
    	at flash.display::MovieClip()
    	at widgetland()
    
    

    I tried removing the instance of that clip, but another clip was then the stopping point (cannot create property mc_background on widgetland).

     

    My widgetland.as:

    package  {
    	
    	import flash.display.MovieClip;
    	import com.greensock.*;
    	import com.greensock.easing.*;
    	import flash.events.Event;
    	public class widgetland extends MovieClip {
    		
    		public var tl:TimelineMax;
    		
    		public function widgetland() {
    			if (stage) {
    				init();
    			} else {
    				addEventListener(Event.ADDED_TO_STAGE,init);
    			}
    
    		}
    
    		private function init(e:Event = null):void {
    			removeEventListener(Event.ADDED_TO_STAGE,init);
    			tl = new TimelineMax();
    			//tl.to(mc, 1, {x:300})
    			//  .to(mc, 1, {y:200});
    			tl.insert( TweenLite.to(mc_logo_globe, 6, {rotation:"765", delay:3}) );
    			
    				tl.insert( TweenLite.from(mc_gear_left, 6, {alpha:0, ease:Linear.easeNone}) );
    				tl.insert( TweenLite.from(mc_gear_center, 6, {alpha:0, ease:Linear.easeNone}) );
    				tl.insert( TweenLite.from(mc_gear_right, 6, {alpha:0, ease:Linear.easeNone}) );
    			
    				tl.insert( TweenLite.to(mc_gear_left, 4, {rotation:"-336", ease:Linear.easeNone}) );
    				tl.insert( TweenLite.to(mc_gear_center, 4, {rotation:"336", ease:Linear.easeNone}) );
    				tl.insert( TweenLite.to(mc_gear_right, 4, {rotation:"-336", ease:Linear.easeNone}) );
    			
    				tl.insert( TweenLite.from(mc_logo_globe, 4, {alpha:0, scaleX:0, scaleY:0, rotation:"-1440"}) );
    		}
    
    	}
    	
    }
    

    Thanks Carl,

    Steven P

  3.  

    There is no way for the parent swf to know what functions to call or what TimelineLite/Max instances to play()… although you very well could program this in.

     

    Does this mean that I cannot use Greensock-powered SWFs with your solution Carl? I ask because using CS4 to open the four sub-FLAs resulted in "unknown file type" errors, so I could not see for myself.

  4. Thanks Carl. I'd actually already found your CS4 fla and tried it. This is the output (after I change the names of the 4 SWFs to the ones I want to play):

    SWFLoader 'loader2' (dev_stone_and_ivy-03.swf) loaded
    SWFLoader 'loader1' (typing.swf) loaded
    SWFLoader 'loader3' (clusterBomb-windgetland-dev-1_0.swf) loaded
    SWFLoader 'loader4' (AS3-widgetland_dev-1_4.swf) loaded
    all swfs loaded
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    	at loadSWFsPlaySequence_fla::MainTimeline/initCurrentLoader()
    	at loadSWFsPlaySequence_fla::MainTimeline/completeHandler()
    	at flash.events::EventDispatcher/dispatchEventFunction()
    	at flash.events::EventDispatcher/dispatchEvent()
    	at com.greensock.loading.core::LoaderCore/_completeHandler()
    	at com.greensock.loading::LoaderMax/_loadNext()
    	at flash.events::EventDispatcher/dispatchEventFunction()
    	at flash.events::EventDispatcher/dispatchEvent()
    	at com.greensock.loading.core::LoaderCore/_completeHandler()
    	at com.greensock.loading::SWFLoader/_completeHandler()
    

    Again, a 1009 error. The four SWFs I created were single-frame movies using Greensock code, and work fine stand-alone.

     

    I'll try to distill the code, but each are rather complex; to me, anyway.

     

    Thanks,

    Steven P

  5. Greetings and best wishes for the-day-after-thanksgiving.
     
    I've been trying to get my head around loading SWFs. I have a number of SWFs that I wanted to play one after the other and can not accomplish this (always starts the last one loaded), so I wanted to just load a SWF in an existing FLA.
     
    The FLA is a three frame deal where I run through a bunch of tweens and timelines in each frame and when the final tween completed, we go to the next frame. So I figured all I had to do was create a frame with this:
     

    stop();
    
    import com.greensock.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.*;
    import com.greensock.loading.display.*;
    import flash.events.Event;
    import com.greensock.*;
    import com.greensock.plugins.*;
    import com.greensock.easing.*;
     
    function Part01() {
        var holder = new MovieClip();
        addChild(holder);
        var loader:SWFLoader = new SWFLoader("typing.swf", {container:holder});
        loader.load();
    }
    
    Part01();

    The SWF starts but reaches a certain place (same every time) and unfortunately, this returns a seeming infinitely looping error:

        at com.greensock::TweenLite/render()
        at com.greensock.core::SimpleTimeline/render()
        at com.greensock.core::Animation$/_updateRoot()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.

    So, I removed the first three frames so that this frame and layer - and only this frame and layer - existed. I tested the movie again and it worked like a champ with no errors: the SWF was loaded and played.

     

     

    So .... why am I getting errors loading this into the final frame of an existing project?

     

    Thanks,

    Steven P.

  6. Greetings,

     

    I've adapted a slide show from code I found on these forums.

     

    I am trying to get my head around loading and layers. I have a watermark (mc_overlay) on a layer above a layer containing movie clip (mc_holder) into which I am loading a series of images. The first image does not get the water mark above, but every image thereafter does get the watermark. When it cycles back to the beginning, the first image still appears above the layer I want it to be under (I assume, since there is no mc_overlay in view).

     

    layers:

    3 mc_overlay

    2 mc_holder

    1 AS

     

    My code:

    import com.greensock.*;
    import com.greensock.loading.*;
    import com.greensock.events.LoaderEvent;
    import com.greensock.loading.display.*;
    
    var loadedImages:Array = [];
    var curIndex:int = -1;
    
    var queue:LoaderMax = new LoaderMax({maxConnections:1, onChildComplete:completeHandler});
    queue.append( new ImageLoader("images/ansel_adams/1.jpg") );
    queue.append( new ImageLoader("images/ansel_adams/2.jpg") );
    queue.append( new ImageLoader("images/ansel_adams/3.jpg") );
    queue.append( new ImageLoader("images/ansel_adams/4.jpg") );
    queue.append( new ImageLoader("images/ansel_adams/5.jpg") );
    queue.load();
    
    //...add preloader here...
    function completeHandler(event:LoaderEvent):void {
    	var image:ContentDisplay = event.target.content;
    	image.alpha = 0;
    	image.visible = false;
    	loadedImages.push(image);
    	if (curIndex == -1) {
    		//...remove preloader here...
    		showNext();
    	}
    }
    
    function showNext():void {
    	if (curIndex != -1) {
    		TweenMax.to(loadedImages[curIndex], 1, {autoAlpha:0}); //fade old out
    	}
    	curIndex++;
    	if (curIndex >= loadedImages.length) {
    		curIndex = 0;
    	}
    	var image:ContentDisplay = loadedImages[curIndex];
    	//this.addChild(image); //brings to the front //original
    	mc_holder.addChild(image); //brings to the front
    	TweenMax.to(image, 1, {autoAlpha:1});
    	TweenMax.delayedCall(5, showNext);
    }
    
    

    Thanks in advance,

    The user formerly known as Steven P

×
×
  • Create New...