Jump to content
GreenSock

attaboy

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by attaboy

  1. I'm hoping to find an example vertically scrolling text where the text disappears once it scrolls past the top of the mask
  2. If you set yoyo to false it works but I want to leave the yoyo effect in. I've attached the project minus the com folder.
  3. Thanks! I should have thought of that. Now it works except that the tween only runs once. that is it runs loadSlide which loads a new image then it runs displaySlide but when in displaySlide it doesn't run the tween again like I want it to or rather it does run the tween but the tween doesn't tween it just sends it back to loadSlide and the process just keeps looping between the two functions like I want it to but still only one tween.
  4. In the example below I have a simple sideshow. In the last line I try to make it run loadSlide() but I did something wrong. I just started learning greensock a couple of days ago so I'm purdy igirant. I'll see if I can find a tutorial that tells me what I need. In the mean time maybe someone will answer this post. package com.droolpigs { import com.greensock.*; import com.greensock.easing.*; import flash.display.*; import flash.utils.*; import flash.events.*; import flash.net.*; public class Slideshow1219 extends Sprite { var bars:Bars = new Bars(); var n:int = 0; var intCurrentSlide:int; var req:URLRequest; var holder:Sprite = new Sprite(); var loader:Loader; var rand:int; var nxtNum:int; var picNum:String; var intSlideCount:int; var xmlLoader:URLLoader; // slideshow xml loader var xmlSlideshow:XML; // slideshow xml var strXMLPath:String = "slideshow-data.xml"; var zzz:String; var history:Array = new Array(); var timeline:TimelineMax=new TimelineMax({repeat:-1,repeatDelay:2.5,yoyo:true}); var duration:Number=.5; public function Slideshow1219(){ nxtNum = rand + 10000; picNum = intCurrentSlide.toString(); xmlLoader = new URLLoader(); xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete); xmlLoader.load(new URLRequest(strXMLPath)); } private function onXMLLoadComplete(e:Event):void { xmlLoader.removeEventListener(Event.COMPLETE, onXMLLoadComplete); xmlSlideshow = new XML(e.target.data); // create new xml with the received data intSlideCount = xmlSlideshow..image.length(); // get total slide count loadSlide(); } private function loadSlide():void { rand = Math.ceil(Math.random()* intSlideCount); trace("intSlideCount "+intSlideCount); loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, displaySlide); zzz = xmlSlideshow..@src[rand].toString(); history.push(zzz); trace("history "+history); loader.load(new URLRequest(xmlSlideshow..@src[rand])); } private function displaySlide(e:Event = null):void { holder.addChild(loader); holder.mask=bars; bars.cacheAsBitmap=true; holder.cacheAsBitmap=true; addChild(bars); addChild(holder); addChild(bars); var timeline:TimelineMax=new TimelineMax({repeat:1,repeatDelay:1,yoyo:true,onComplete:loadSlide()}); var duration:Number=.5; loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, displaySlide); trace("loader.content "+loader.content); holder.addChild(loader.content); addChildAt(holder, 0); if(holder.numChildren > 1){holder.removeChildAt(0);} bars.width=holder.width; bars.height=holder.height; for (var count:Number = 1; count <=10; count++) { var mc:MovieClip=bars["bar"+count]; timeline.append(TweenMax.from(mc, duration, {x:"64", alpha:0, ease:Cubic.easeOut}), -.4); } } } } btw: if I remove the onComplete the tween works but just loads one slide. I want to load a slide, run the tween, load another slide ,etc..
  5. yippie skippy of course I didn't add to stage! thank you so much!
  6. I'm very new to this forum, I was sure I uploaded a zip but I see no sign of it. I will try again.
  7. I tried what you suggested but no change. The thing that seems really strange to me is that to activate the tween I have to re-size the stage. Thanks so much for offering to help.
  8. I found a simple tween with the following code: import com.greensock.*; import com.greensock.easing.*; bars.cacheAsBitmap=true; img.cacheAsBitmap=true; img.mask=bars; //create TimelineMax instance and set to repeat infinitely var timeline:TimelineMax=new TimelineMax({repeat:-1,repeatDelay:1,yoyo:true}); //speed vars var duration:Number=.5; //loop through bar in bars clip and add tween to timeline for (var count:Number = 1; count <=10; count++) { //create reference to each individual clip var mc:MovieClip=bars["bar"+count]; timeline.append(TweenMax.from(mc, duration, {x:"64", alpha:0, ease:Cubic.easeOut}), -.4); } In the example the image and mask are both on the stage from the start - not added dynamically. you can see it here: http://www.jimslounge.com/tweenTest/mask_bars.swf I would like to integrate it into my slide show here is the code: import com.greensock.*; import com.greensock.easing.*; var bars:Bars = new Bars(); var xmlLoader:URLLoader; // slideshow xml loader var xmlSlideshow:XML; // slideshow xml var strXMLPath:String = "slideshow-data.xml"; var loader:Loader; var intSlideCount:int; var holder:Sprite = new Sprite(); xmlLoader = new URLLoader(); xmlLoader.addEventListener(Event.COMPLETE, onXMLLoadComplete); xmlLoader.load(new URLRequest(strXMLPath)); function onXMLLoadComplete(e:Event):void { xmlLoader.removeEventListener(Event.COMPLETE, onXMLLoadComplete); xmlSlideshow = new XML(e.target.data); // create new xml with the received data intSlideCount = xmlSlideshow..image.length(); // get total slide count loadSlide(null); } function loadSlide(e:Event):void { trace("we loaded slide"); loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, displaySlide); loader.load(new URLRequest(xmlSlideshow..@src[1])); trace(loader.contentLoaderInfo); } function displaySlide(e:Event):void { holder.addChild(loader); bars.cacheAsBitmap=true; holder.cacheAsBitmap=true; holder.mask=bars; addChild(holder); var timeline:TimelineMax=new TimelineMax({repeat:-1,repeatDelay:2.5,yoyo:true}); var duration:Number=.5; for (var count:Number = 1; count <=10; count++) { //create reference to each individual clip var mc:MovieClip=bars["bar"+count]; timeline.append(TweenMax.from(mc, duration, {x:"64", alpha:0, ease:Cubic.easeOut}), -.4); bars.width=holder.width; bars.height=holder.height; } } I create an instance of a Sprite, load an external image using xml, add the image as a child of the Sprite instance "holder", add holder the the stage then run the tween. this is what it looks like http://www.jimslounge.com/tweenTest/my_mask_bars.swf The tween doesn't run till I re-size the stage and when it runs gives a different effect.
  9. You could probably use some of the popular cms systems like Joomla or Word Press
  10. how do I mark a post as answered? I've been looking all over. it's probably in plain sight But I don't see it.
  11. Can I delay the start of a tween using tweenlight or tweenmax or do I have to use Actionscript?
×