Jump to content
Search Community

beno

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by beno

  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
  16. Your advice about adding the timeline once was of course very good. Here's the revised code: var timeline:TimelineMax = new TimelineMax({onComplete:NextSlide()}); while (i <= _totalSlides) { timeline.append(TweenLite.to(parent_container, 1, {delay:2.5, x:j-_w}) ); ++i; } I'm not tracing i because I've done that both here and in NextSlide and it traces exactly what I expect. What happens in that fn is that I remove all the slides in the parent container (each slide is in its own container, contained in the parent container), move the slides over one, drop one off and add a new one (hence the iteration of i) and add them all once again to the parent container. That's why I don't change the values of j or _w. Anyways, it's still only performing the tween once Here's NextSlide and AddSlide, which is called by the former. A lot of cleaning up to do, but here goes: function AddSlides():void { var _const:Number = new Number(); _const = (Math.round((i+_numOfSlides/2)/_numOfSlides)); var _const_mod:Number = new Number(); _const_mod = _const*_numOfSlides%imagesArray.length; if (_const_mod == _numOfSlides) { _const = 1; } else { _const = 0; } var _mod:Number = new Number(); _mod = i%_numOfSlides; _one = _const*_numOfSlides+_mod; _two = _const*_numOfSlides+_mod+1; _three = _const*_numOfSlides+_mod+2; _four = _const*_numOfSlides+_mod+3; _five = _const*_numOfSlides+_mod+4; _six = _const*_numOfSlides+_mod+5; img0.myArray = [imagesArray[_one], "index.py", _w, _h, ((_w+spacer)*j)+_x+600, _y]; img1.myArray = [imagesArray[_two], "index.py", _w, _h, ((_w+spacer)*(j-1))+_x+600, _y]; img2.myArray = [imagesArray[_three], "index.py", _w, _h, ((_w+spacer)*(j-2))+_x+600, _y]; img3.myArray = [imagesArray[_four], "index.py", _w, _h, ((_w+spacer)*(j-3))+_x+600, _y]; img4.myArray = [imagesArray[_five], "index.py", _w, _h, ((_w+spacer)*(j-4))+_x+600, _y]; img5.myArray = [imagesArray[_six], "index.py", _w, _h, ((_w+spacer)*(j-5))+_x+600, _y]; container0.addChild(img0); container1.addChild(img1); container2.addChild(img2); container3.addChild(img3); container4.addChild(img4); container5.addChild(img5); parent_container.addChild(container0); parent_container.addChild(container1); parent_container.addChild(container2); parent_container.addChild(container3); parent_container.addChild(container4); parent_container.addChild(container5); } function NextSlide():void { spacer = 10; j = i%_numOfSlides; var container:MovieClip = new MovieClip(); img.myArray = [imagesArray[j], "index.py", _w, _h, (_w+spacer)*j+_x+70, _y]; if (container0.parent) { container0.parent.removeChild(container0); } if (container1.parent) { container1.parent.removeChild(container1); } if (container2.parent) { container2.parent.removeChild(container2); } if (container3.parent) { container3.parent.removeChild(container3); } if (container4.parent) { container4.parent.removeChild(container4); } if (container5.parent) { container5.parent.removeChild(container5); } if (_one > _numOfSlides) { _one = _one - _numOfSlides } if (_two > _numOfSlides) { _two = _two - _numOfSlides } if (_three > _numOfSlides) { _three = _three - _numOfSlides } if (_four > _numOfSlides) { _four = _four - _numOfSlides } if (_five > _numOfSlides) { _five = _five - _numOfSlides } if (_six > _numOfSlides) { _six = _six - _numOfSlides } AddSlides(); container.addChild(img); } TIA, beno
  17. Hi; I hve this code: while (i <= _totalSlides) { var timeline:TimelineMax = new TimelineMax({onComplete:NextSlide()}); timeline.append(TweenLite.to(parent_container, 1, {delay:2.5, x:j-_w}) ); ++i; trace(i); } Now, that trace prints out numbers 6-12 as it should...however, it does so without any delay and before my images are printed to screen. There is a 2.5 sec delay before the images print to screen, but what I want is a 2.5 sec delay for *every* iteration of the loop. Before the loop I fill up a container (mc) with 5 images. I next run the loop to: (1) slide the images over, and (2) call the NextSlide fn that will lop off one image and insert another, then (3) repeat the whole process until we run out of images (slides). It ain't doin' that and the problem appears to be in my while loop. TIA, beno
  18. beno

    Error #1069

    Correction again: var timeline:TimelineMax = new TimelineMax({pnComplete:NextSlide()}); beno
  19. beno

    Error #1069

    My bad (imagine that). Line should be: var timeline:TimelineMax = new TimelineMax({pnComplete:NextSlide}); Thanks, beno
  20. beno

    Error #1069

    Hi and Happy New Year: I get this error: ReferenceError: Error #1069: Property delay not found on builtin.as$0.MethodClosure and there is no default value. at com.greensock.core::TweenCore() at com.greensock.core::SimpleTimeline() at com.greensock::TimelineLite() at com.greensock::TimelineMax() at Slides/TheSlides() at Slides/set myVars() at MilleniumMain/SlideShow() at MilleniumMain/CatBox() at MilleniumMain/BottomBox() at MilleniumMain/Navbar() at MilleniumMain/MainPage() at MilleniumMain() Now the code responsible is here: while (i < _totalSlides) { // NextSlide(); var timeline:TimelineMax = new TimelineMax(NextSlide); timeline.append(TweenLite.to(parent_container, 1, {delay:2.5, x:j-_w}) ); ++i; } If I uncomment the commented line and comment out the next two lines it works (not like I want, of course) and no errors are thrown. When I was originally working with this code there was no error on the delay. Furthermore, if I delete the delay in the above it still throws the same error! And I know that code works because it worked earlier (before trying to call NextSlide). But I have no idea how to fix it. Below is the whole code for this particular class. I've also uploaded the whole bloody mess here: http://creative.vi/Millenium.tar TIA, beno package { import com.greensock.*; import flash.display.MovieClip; import flash.events.TimerEvent; import flash.utils.Timer; import Slides2; import Images; public class Slides extends MovieClip { var parent_container:MovieClip = new MovieClip(); var container0:MovieClip = new MovieClip(); var container1:MovieClip = new MovieClip(); var container2:MovieClip = new MovieClip(); var container3:MovieClip = new MovieClip(); var container4:MovieClip = new MovieClip(); var container5: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 _numOfSlides:Number = new Number(0); var _totalSlides:Number = new Number(0); var _w:Number = new Number(0); var _h:Number = new Number(0); var _x:Number = new Number(0); var _y:Number = new Number(0); var _vars:Array = new Array(); var img:Images = new Images(); var img0:Images = new Images(); var img1:Images = new Images(); var img2:Images = new Images(); var img3:Images = new Images(); var img4:Images = new Images(); var img5:Images = new Images(); var i:Number = new Number(); public function Slides():void { if (parent_container.parent) { parent_container.parent.removeChild(parent_container); } if (container0.parent) { container0.parent.removeChild(container0); } if (container1.parent) { container1.parent.removeChild(container1); } if (container2.parent) { container2.parent.removeChild(container2); } if (container3.parent) { container3.parent.removeChild(container3); } if (container4.parent) { container4.parent.removeChild(container4); } if (container5.parent) { container5.parent.removeChild(container5); } addChild(parent_container); parent_container.addChild(container0); parent_container.addChild(container1); parent_container.addChild(container2); parent_container.addChild(container3); parent_container.addChild(container4); parent_container.addChild(container5); } public function set myVars(_vars:Array):void { _numOfSlides = _vars[0]; _totalSlides = _vars[1]; _w = _vars[2]; _h = _vars[3]; _x = _vars[4]; _y = _vars[5]; TheSlides(_numOfSlides, _totalSlides, _w, _h, _x, _y); } function TheSlides(_numOfSlides:Number, _totalSlides:Number, _w:Number, _h:Number, _x:Number, _y:Number):void { var spacer:Number = new Number(10); var j:Number = new Number(i%_numOfSlides); var container:MovieClip = new MovieClip(); while (i > 6) { switch (i) { case (0): container = container0; break; case (1): container = container1; break; case (2): container = container2; break; case (3): container = container3; break; case (4): container = container4; break; case (5): container = container5; break; } container.addChild(img); i++; } i = 6; while (i < _totalSlides) { // NextSlide(); var timeline:TimelineMax = new TimelineMax(NextSlide); timeline.append(TweenLite.to(parent_container, 1, {delay:2.5, x:j-_w}) ); ++i; } } function NextSlide():void { var spacer:Number = new Number(10); var j:Number = new Number(i%_numOfSlides); var container:MovieClip = new MovieClip(); while (i < _totalSlides) { img.myArray = [imagesArray[j], "index.py", _w, _h, (_w+spacer)*j+_x+70, _y]; if (container0.parent) { container0.parent.removeChild(container0); } if (container1.parent) { container1.parent.removeChild(container1); } if (container2.parent) { container2.parent.removeChild(container2); } if (container3.parent) { container3.parent.removeChild(container3); } if (container4.parent) { container4.parent.removeChild(container4); } if (container5.parent) { container5.parent.removeChild(container5); } var _const:Number = new Number(); _const = (Math.round((i+_numOfSlides/2)/_numOfSlides)); var _const_mod:Number = new Number(); _const_mod = _const*_numOfSlides%imagesArray.length; if (_const_mod == _numOfSlides) { _const = 1; } else { _const = 0; } var _mod:Number = new Number(); _mod = i%_numOfSlides; var _one:Number = new Number(_const*_numOfSlides+_mod); var _two:Number = new Number(_const*_numOfSlides+_mod+1); var _three:Number = new Number(_const*_numOfSlides+_mod+2); var _four:Number = new Number(_const*_numOfSlides+_mod+3); var _five:Number = new Number(_const*_numOfSlides+_mod+4); var _six:Number = new Number(_const*_numOfSlides+_mod+5); if (_one > _numOfSlides) { _one = _one - _numOfSlides } if (_two > _numOfSlides) { _two = _two - _numOfSlides } if (_three > _numOfSlides) { _three = _three - _numOfSlides } if (_four > _numOfSlides) { _four = _four - _numOfSlides } if (_five > _numOfSlides) { _five = _five - _numOfSlides } if (_six > _numOfSlides) { _six = _six - _numOfSlides } img0.myArray = [imagesArray[_one], "index.py", _w, _h, ((_w+spacer)*j)+_x+70, _y]; img1.myArray = [imagesArray[_two], "index.py", _w, _h, ((_w+spacer)*(j-1))+_x+70, _y]; img2.myArray = [imagesArray[_three], "index.py", _w, _h, ((_w+spacer)*(j-2))+_x+70, _y]; img3.myArray = [imagesArray[_four], "index.py", _w, _h, ((_w+spacer)*(j-3))+_x+70, _y]; img4.myArray = [imagesArray[_five], "index.py", _w, _h, ((_w+spacer)*(j-4))+_x+70, _y]; img5.myArray = [imagesArray[_six], "index.py", _w, _h, ((_w+spacer)*(j-5))+_x+70, _y]; container0.addChild(img0); container1.addChild(img1); container2.addChild(img2); container3.addChild(img3); container4.addChild(img4); container5.addChild(img5); parent_container.addChild(container0); parent_container.addChild(container1); parent_container.addChild(container2); parent_container.addChild(container3); parent_container.addChild(container4); parent_container.addChild(container5); container.addChild(img); i++; } } } }
  21. beno

    Alpha Problem

    Another boner. Should have set the container's alpha to 0. Sorry again. beno
  22. Hi; I have this code: function WatchMovements() { watchMovements.x = 0; watchMovements.y = 0; watchMovements.alpha = 1; watchMovements.scaleX = watchMovements.scaleY = .5; var watchMovements_container:Sprite = new Sprite(); addChild(watchMovements_container); watchMovements_container.addChild(watchMovements); var watchMovements_timeline:TimelineMax = new TimelineMax(); watchMovements_timeline.append(new TweenLite(watchMovements_container, 1, {x: stage.stageWidth/1.5, alpha: .7})); } Now, if I initially set the alpha to, say, .7 instead of 1, the image will further fade to .7 squared when the tween is applied. My problem is I need to set the initial alpha to 0, which means I can't multiply it high enough to get anything over 0. What do? TIA, beno
  23. Hi; Here's my code: var timeline:TimelineLite = new TimelineLite(); timeline.append(new TweenLite(star_container, .4, {alpha: 1})); timeline.append(new TweenLite(star_container, .2, {rotation: 90, scaleX: 1.5, scaleY: 1.5})); timeline.append(new TweenLite(star_container, .2, {rotation: 180, scaleX: .5, scaleY: .5})); timeline.append(new TweenLite(star_container, .2, {rotation: 270, scaleX: 1, scaleY: 1})); timeline.append(new TweenLite(star_container, .4, {alpha: 0})); // timeline.repeat = 2; // timeline.repeatDelay = 0.5; // timeline.pause(); // timeline.reverse(); Now, here are the problems I'm having *after* rebooting my Mac even: 1) If I uncomment the repeat and repeatDelay lines Flash complains "1119 Access of possibly undefined property..." 2) If I uncomment the last two lines there are no errors but nothing prints to screen. This is with a brand new download of your s/w. Please advise. TIA, beno
  24. beno

    Timeline Q

    My computer shut down due to a power outage. When I rebooted, everything worked fine :-} Thanks, beno
×
×
  • Create New...