Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

beno

Members
  • Posts

    78
  • Joined

  • Last visited

beno's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. If you look at that function, you will see that virtually the only thing it does is: 1) assign values to variables, and; 2) call another function; namely, Images. Now, remember, this function did in fact correctly tween before I took out the removeChild() calls. I guess I'm foolish, but to me it seems to me that there is either a bug in GreenSock or in Flash, because I don't see how taking out the removeChild() calls could possibly do this to my class. Good luck? Ah, well, thanks for the vote of confidence, and thanks for your help in other posts of mine. Beno
  2. Here is the original code: public function Slides(_numOfSlides:int, _totalSlides:int, _w:int, _h:int, _x:int, _y:int):void { if (parent_container.parent) { parent_container.parent.removeChild(parent_container); } addChild(parent_container); var container:MovieClip = new MovieClip(); spacer = 10; AddSlides(); timeline = new TimelineMax({onComplete:NextSlide()}); timeline.append(TweenLite.to(parent_container, 0, {x:150}) ); } modified to this: public function Slides(_numOfSlides:int, _totalSlides:int, _w:int, _h:int, _x:int, _y:int):void { addChild(parent_container); var container:MovieClip = new MovieClip(); spacer = 10; XMLLoader(); AddSlides(); parent_container.x = 150; NextSlide(); } but since that only runs once and this happens with every tween, it is probably this code: function NextSlide():void { spacer = 10; iterations++; i = 0; while (i != parent_container.numChildren) { parent_container.removeChildAt(i); } if (parent_container.parent) { removeChild(parent_container); parent_container = null; parent_container = new MovieClip(); addChild(parent_container); } LoadImageDisplayArray(); myTimer.addEventListener(TimerEvent.TIMER, CallNextSlide); myTimer.start(); } now modified to: function NextSlide():void { spacer = 10; iterations++; LoadImageDisplayArray(); myTimer.addEventListener(TimerEvent.TIMER, CallNextSlide); myTimer.start(); } TIA, Beno
  3. First up, yes, an infinite loop is indeed what I want. Concerning the overwrite manager, yes, there is a tween before the loop; however, according to the docs, it is immediately overwritten by the first call to the loop. Again, this worked fine before the aforementioned necessary edit, and that previous tween was there then, too. Ideas? TIA, Beno
  4. Hi; I have a very straightforward tween that *was* behaving properly before I deleted a removeChild() which preceded an addChild() statement for the same variable because I was told that was unnecessary and that it was causing another problem, which indeed it was and is now resolved. *However*, before that deletion the following tween was working. Now it waits the appointed 1 second and then all of a sudden moves the movie along the x axis in one sudden movement. I've tried many variations of this--TweenLite, TweenMax, TimelineMax, etc.-- and they all do the same thing. function CallNextSlide(event:TimerEvent):void { TweenMax.to(parent_container, 1, {x:150, onComplete:NextSlide}); // TweenLite.to(parent_container, 2, {x:150, onComplete:NextSlide()}); } } Here's the full code: package { import com.greensock.*; import flash.display.MovieClip; import flash.events.TimerEvent; import flash.utils.Timer; import flash.net.URLRequest; import flash.net.URLLoader; import flash.display.Loader; import flash.display.LoaderInfo; import flash.events.Event; import Images; [sWF(backgroundColor="0x000000", width="1008", height="548")] public class Slides extends MovieClip { var parent_container:MovieClip = new MovieClip(); var imagesArray:Array = new Array("images/1.png", "images/2.png", "images/3.png", "images/4.png", "images/5.png", "images/6.png", "images/7.png", "images/8.png", "images/9.png", "images/10.png", "images/11.png", "images/12.png"); var _totalSlides:Number = new Number(12); var _numOfSlides:Number = new Number(6); var _totalImages:Number = new Number(12); var _w:Number = new Number(120); var _h:Number = new Number(120); var _x:Number = new Number(213); var _y:Number = new Number(150); var img:Images; var img0:Images; var img1:Images; var img2:Images; var img3:Images; var img4:Images; var img5:Images; var i:int; var spacer:int; var j:int; var _firstImageInArray:int; var _secondImageInArray:int; var _thirdImageInArray:int; var _fourthImageInArray:int; var _fifthImageInArray:int; var _sixthImageInArray:int; var _firstImageInArrayURL:String = new String(); var _secondImageInArrayURL:String = new String(); var _thirdImageInArrayURL:String = new String(); var _fourthImageInArrayURL:String = new String(); var _fifthImageInArrayURL:String = new String(); var _sixthImageInArrayURL:String = new String(); var _const:int; var _const_mod:int; var k:int = 0; var _mod:int; var ImageDisplayArray:Array; var myTimer:Timer = new Timer(1000); var iterations:int=0; var urlXMLLoader:URLLoader; var shoppingCartImagesArray:Array = new Array(); var shoppingCartURLArray:Array = new Array(); var imageDir:String = new String(); public function Slides(_numOfSlides:int, _totalSlides:int, _w:int, _h:int, _x:int, _y:int):void { addChild(parent_container); var container:MovieClip = new MovieClip(); spacer = 10; XMLLoader(); AddSlides(); parent_container.x = 150; NextSlide(); } function XMLLoader() { var urlXMLRequest:URLRequest = new URLRequest('shoppingCartImages.xml'); urlXMLLoader = new URLLoader(); urlXMLLoader.addEventListener(Event.COMPLETE, completeXMLListener); urlXMLLoader.load(urlXMLRequest); } function completeXMLListener(e:Event):void { var xmlData:XML = XML (e.target.data); imageDir = xmlData.IMAGE_FOLDER.text() var list:String = new String(xmlData.IMAGES.text()); shoppingCartImagesArray = list.split(","); list = null; list = xmlData.URLS.text(); shoppingCartURLArray = list.split(","); list = null; trace(imageDir); trace(shoppingCartURLArray); } function AddSlides():void { _const = (Math.round((iterations+_numOfSlides/2)/_numOfSlides)); _const_mod = _const*_numOfSlides%imagesArray.length; if (_const_mod == _numOfSlides) { _const = 1; } else { _const = 0; } LoadImageDisplayArray(); } function LoadImageDisplayArray():void { ImageDisplayArray = null; ImageDisplayArray = new Array(); _mod = iterations%_numOfSlides; if (iterations == _numOfSlides) { _firstImageInArray = _const*_numOfSlides+_mod; _secondImageInArray = _const*_numOfSlides+_mod+1; _thirdImageInArray = _const*_numOfSlides+_mod+2; _fourthImageInArray = _const*_numOfSlides+_mod+3; _fifthImageInArray = _const*_numOfSlides+_mod+4; _sixthImageInArray = _const*_numOfSlides+_mod+5; _firstImageInArrayURL = imagesArray[_const*_numOfSlides+_mod].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _secondImageInArrayURL = imagesArray[_const*_numOfSlides+_mod+1].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _thirdImageInArrayURL = imagesArray[_const*_numOfSlides+_mod+2].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _fourthImageInArrayURL = imagesArray[_const*_numOfSlides+_mod+3].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _fifthImageInArrayURL = imagesArray[_const*_numOfSlides+_mod+4].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _sixthImageInArrayURL = imagesArray[_const*_numOfSlides+_mod+5].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); iterations = -1; } else { _firstImageInArray = _const*_numOfSlides+_mod-6; _secondImageInArray = _const*_numOfSlides+_mod-5; _thirdImageInArray = _const*_numOfSlides+_mod-4; _fourthImageInArray = _const*_numOfSlides+_mod-3; _fifthImageInArray = _const*_numOfSlides+_mod-2; _sixthImageInArray = _const*_numOfSlides+_mod-1; _firstImageInArrayURL = imagesArray[_const*_numOfSlides+_mod-6].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _secondImageInArrayURL = imagesArray[_const*_numOfSlides+_mod-5].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _thirdImageInArrayURL = imagesArray[_const*_numOfSlides+_mod-4].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _fourthImageInArrayURL = imagesArray[_const*_numOfSlides+_mod-3].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _fifthImageInArrayURL = imagesArray[_const*_numOfSlides+_mod-2].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); _sixthImageInArrayURL = imagesArray[_const*_numOfSlides+_mod-1].replace("images/", "").replace("png","py").replace("jpg","py").replace("gif","py"); } k = 0; while (k < _numOfSlides) { switch(k) { case(0): img0 = new Images(imagesArray[_firstImageInArray], _w, _h, ((_w+spacer)*j)+_x+600, _y, _firstImageInArrayURL); ImageDisplayArray.push(img0); break; case(1): img1 = new Images(imagesArray[_secondImageInArray], _w, _h, ((_w+spacer)*(j-1))+_x+600, _y, _secondImageInArrayURL); ImageDisplayArray.push(img1); break; case(2): img2 = new Images(imagesArray[_thirdImageInArray], _w, _h, ((_w+spacer)*(j-2))+_x+600, _y, _thirdImageInArrayURL); ImageDisplayArray.push(img2); break; case(3): img3 = new Images(imagesArray[_fourthImageInArray], _w, _h, ((_w+spacer)*(j-3))+_x+600, _y, _fourthImageInArrayURL); ImageDisplayArray.push(img3); break; case(4): img4 = new Images(imagesArray[_fifthImageInArray], _w, _h, ((_w+spacer)*(j-4))+_x+600, _y, _fifthImageInArrayURL); ImageDisplayArray.push(img4); break; case(5): img5 = new Images(imagesArray[_sixthImageInArray], _w, _h, ((_w+spacer)*(j-5))+_x+600, _y, _sixthImageInArrayURL); img5.addEventListener("xxx",URLs); ImageDisplayArray.push(img5); break; } ++k; } k = 0; while (k < ImageDisplayArray.length) { parent_container.addChild(ImageDisplayArray[k]); k++; } } function URLs(e:Event):void { // trace('hit'); } function NextSlide():void { spacer = 10; iterations++; LoadImageDisplayArray(); myTimer.addEventListener(TimerEvent.TIMER, CallNextSlide); myTimer.start(); } function CallNextSlide(event:TimerEvent):void { TweenMax.to(parent_container, 1, {x:150, onComplete:NextSlide}); // TweenLite.to(parent_container, 2, {x:150, onComplete:NextSlide()}); } } } Here's the code for Images: package { import flash.events.IEventDispatcher; import flash.events.EventDispatcher; import flash.events.Event; import flash.display.MovieClip; import flash.display.Sprite; import flash.display.Bitmap; import flash.display.BitmapData; import flash.filters.*; import flash.filters.BitmapFilterQuality; import flash.net.URLRequest; import flash.net.URLLoader; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.DisplayObject; import flash.events.Event; import flash.events.IOErrorEvent; public class Images extends MovieClip { private var parent_container:Sprite = new Sprite(); private var _path:String = new String("path"); private var _myWidth:Number = new Number(20); private var _myHeight:Number = new Number(20); private var _myX:Number = new Number(20); private var _myY:Number = new Number(20); private var _myURL:String = new String("url"); public function Images(path:String, myWidth:uint, myHeight:uint, myX:uint, myY:uint, myURL:String="") { _path = path; _myURL = myURL; _myWidth = myWidth; _myHeight = myHeight; _myX = myX; _myY = myY; LoadImage(); } function LoadImage():void { parent_container = new Sprite(); addChild(parent_container) var req:URLRequest = new URLRequest(_path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadedImage); } function LoadedImage(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = _myWidth; displayObject.height = _myHeight; parent_container.addChild(displayObject); parent_container.x = _myX; parent_container.y = _myY; if(_myURL == "BACKGROUND_IMAGE") // This is a cheat { dispatchEvent(new Event("loadcomplete")); } else if (_myURL != "") { // this is not a cheat dispatchEvent(new Event("xxx")); } } function ioErrorHandler(event:IOErrorEvent):void { trace("ioErrorHandler: " + event); } } } I call this code from another class thus: var _numOfSlides:Number = new Number(6); var _totalImages:Number = new Number(12); var _w:Number = new Number(120); var _h:Number = new Number(120); var _x:Number = new Number(213); var _y:Number = new Number(150); var mySlides:Slides = new Slides(_numOfSlides, _totalImages, _w, _h, _x, _y); addChild(mySlides); but you could easily tweak the code to run it directly. Please advise. TIA Beno
  5. Thank you. I have made that mistake before, and making that edit did clear up the problem. However, it returned when I took out the following code (which has nothing to do with GS, but I was told to take it out on the Adobe Flash list to get rid of a problem with "blinking" images): i = 0; while (i != parent_container.numChildren) { parent_container.removeChildAt(i); } if (parent_container.parent) { removeChild(parent_container); parent_container = null; parent_container = new MovieClip(); addChild(parent_container); } Again, nothing to do with this forum, but I'd love to know where the glitch really is!! Thanks, Beno
  6. Hi; This works: timeline = new TimelineMax({onComplete:NextSlide()}); timeline.append(TweenLite.to(parent_container, 1, {x:130}) ); but this doesn't: TweenLite.to(parent_container, 1, {x:130, onComplete:NextSlide()}); The latter doesn't slide to the new position, it just suddenly arrives. (The code in between repositions the container. Again, the first example works.) Why doesn't the second example work? TIA, Beno
  7. beno

    Timeline Q

    Yeah, I know my question went beyond the scope of GS, but since we were on the subject :/ Thanks for the tutorial, Carl! Yeah, I went with option 1 for this project, but have another project I'm working on that tackles the same problem but has a dynamic number of images which can be edited and updated by the client, so that tutorial will come in handy in a few days! Thanks again, Beno
  8. beno

    Timeline Q

    Definitely an improvement, Carl, but notice how on the repeat the first image pops into place where I really need it to gracefully slide into place like the others do. I've messed with this but with the equally unsatisfactory result of showing a black screen for a second. Ideas? TIA, Beno
  9. beno

    Timeline Q

    Sorry about that. Please comment these two lines out of the class I sent you: import Navigate; import URLClip; Below is the code for the other class you need. I still can't get this working, but as you say, once you see it it should become obvious what the problems are. TIA, Beno package { import flash.display.MovieClip; import flash.display.Sprite; import flash.display.Bitmap; import flash.display.BitmapData; import flash.filters.*; import flash.filters.BitmapFilterQuality; import flash.net.URLRequest; import flash.net.URLLoader; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.DisplayObject; import flash.events.Event; import flash.events.IOErrorEvent; public class Images extends MovieClip { private var parent_container:Sprite = new Sprite(); private var _path:String = new String("path"); private var _myWidth:Number = new Number(20); private var _myHeight:Number = new Number(20); private var _myX:Number = new Number(20); private var _myY:Number = new Number(20); private var _myURL:String = new String("url"); public function Images():void { } public function set ImagesArray(_imagesArray:Array):void { _path = _imagesArray[0]; _myURL = _imagesArray[1]; _myWidth = _imagesArray[2]; _myHeight = _imagesArray[3]; _myX = _imagesArray[4]; _myY = _imagesArray[5]; LoadImage(); } function LoadImage():void { parent_container = new Sprite(); addChild(parent_container) var req:URLRequest = new URLRequest(_path); var loader:Loader = new Loader(); loader.load(req); loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadedImage); } function LoadedImage(e:Event):void { var loaderInfo:LoaderInfo = e.target as LoaderInfo; var displayObject:DisplayObject = loaderInfo.content; displayObject.width = _myWidth; displayObject.height = _myHeight; parent_container.addChild(displayObject); parent_container.x = _myX; parent_container.y = _myY; } function ioErrorHandler(event:IOErrorEvent):void { trace("ioErrorHandler: " + event); } } }
  10. beno

    Timeline Q

    I must have been unclear. case 0 does trace the first time around. It doesn't trace the second time around (on repeat). Here is a stripped-down version of the files in CS4. Please overlook all the extra imports and var def'ns. Everything else is trimmed down http://creative.vi/clients/Maya2012/Archive.zip TIA, Beno
  11. beno

    Timeline Q

    I'm sorry, yes: repeat the timeline. In the code I sent you last, when the timeline repeats, the trace that I just added to case 0 doesn't trace var countTween; therefore, I don't understand what happens internally with greensock's repeat. I would have expected it to re-read the code, but it doesn't appear to do that. Here is the url you requested: http://creative.vi/clients/Maya2012/index.py You'll see those little buttons at the bottom. When the last one turns light, the next image to scroll across will be the first (repeating the timeline) and I want the first button to light up, but it doesn't. TIA, Beno
  12. beno

    Timeline Q

    Thanks, Carl. That worked great. I have another related problem, however. Here's my code: var timeline:TimelineMax = new TimelineMax({repeat:-1}); while (tweenCount++ < 9) { timeline.append(TweenLite.to(img_container, 1, {x:-1006*tweenCount, delay:6.5, onStart:getTweenCount, onStartParams:[tweenCount]})); } timeline.play(); } private function getTweenCount(currentTween:int):void { switch (currentTween) { case 0: btn0.ImagesArray = ["images/change-img-btn_on.png", "index.py", 45, 45, 0, 0]; container_btn0.x = 1100; container_btn0.y = 474; if (container_btn0.parent) { container_btn0.parent.removeChild(container_btn0); } addChild(container_btn0); container_btn0.addChild(btn0); I then repeat most of that code for each of the button images, changing the image button to the *_off.png. In the subsequent cases, I simply move the *_on.png further down. Now here's the problem. When the tween repeats, the value of currentTween is set at the maximum and the last button is set to *_on.png whereas it should be set to the first button. I would have thought simply passing a new value to currentTween in the last case would have done the trick, but no. (I initially set its value to 0 before running the above code.) What do here? TIA, Beno
  13. beno

    Timeline Q

    Right, Carl, I need to know which tween is playing at any given time and was trying to accomplish that with my code. How should I do this? TIA, Beno
  14. beno

    Timeline Q

    Hi; I have this code: var timeline:TimelineMax = new TimelineMax(); whichPic = 1; while (whichPic <= 9) { timeline.append(TweenLite.to(img_container, .1, {delay:6.5, x:-1006*whichPic}) ); ++whichPic; } timeline.repeat = -1; Works fine. Has an image pop up, stay there for a bit, then slides over another image. Now what I need to do is determine what the value of whichPic is when_it_is_playing. How do? TIA, Beno
  15. Carl wrote: once the first tween runs, parent_container is at an x of j-_w... so all subsequent tweens have nowhere to move parent_container TO as it is already there. in addition, the onComplete:NextSlide will only fire once the timeline completes all of its tweens. From what I gather you want an image to tween, some re-sorting to occur, tween another image and so on. I don't believe that the use of the loop with TimelineMax in its current state is going to achieve that goal. Right. I updated the code thus: i = 6; while (i <= _totalSlides) { var timeline:TimelineMax = new TimelineMax({onComplete:NextSlide()}); if (i > 6) { timeline.append(TweenLite.to(parent_container, 0, {x:j}) ); timeline.append(TweenLite.to(parent_container, 1, {delay:2.5, x:j-_w}) ); } else { timeline.append(TweenLite.to(parent_container, 1, {delay:2.5, x:j-_w}) ); } ++i; } That way I should be repositioning the parent container so it can be re-tweened. Now, regarding the timeline having to tween everything before it can call NextSlide, not so, because if I trace(i) in NextSlide, it successfully prints out every value of i that I expect. Regarding adding a button to click through, for some reason I'm having trouble even adding text to this class that is called by another class through a mask. Even if I widen the mask and try to place the text on top of the slide show, it doesn't show up. Will keep playing with it. Meanwhile, any other comments would be appreciated. TIA, beno
×