Luigi Vercotti

Members
  • Content count

    45
  • Joined

  • Last visited

Community Reputation

1 Newbie

About Luigi Vercotti

  • Rank
    Advanced Member

Contact Methods

Profile Information

  • Location
    MORAVIA
  1. SlideShow

    Can I have anotherone please? I am trying to pause and resume....can you please help me with functions pause and resume at the bottom import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import flash.display.MovieClip; import flash.events.MouseEvent; import flash.events.Event; LoaderMax.activate([ImageLoader]); var index: int = 0; var currentImage: Sprite; var urls: Array = ["images/rm_01.jpg", "images/rm_02.jpg", "images/rm_03.jpg", "images/rm_04.jpg", "images/rm_05.jpg", "images/rm_06.jpg", "images/rm_07.jpg", "images/rm_08.jpg", "images/rm_09.jpg", "images/rm_10.jpg", "images/rm_11.jpg", "images/rm_12.jpg" ]; var queue: LoaderMax = LoaderMax.parse(urls, { onComplete: onCompleteHandler, onProgress: onProgressHandler, maxConnections: 1, onChildComplete: onChildCompleteHandler }, { alpha: 0 }); queue.load(); function onCompleteHandler(e: LoaderEvent): void { trace("all images loaded"); showNextImage(); } function onProgressHandler(e: LoaderEvent): void { trace(e.target.progress); } function onChildCompleteHandler(e: LoaderEvent): void { trace(e.target + " loaded"); } function showNextImage() { trace("image " + index) currentImage = LoaderMax.getContent(urls[index]); currentImage.alpha = 0; //TweenLite.to(currentImage, .5, {alpha:1}); TweenLite.fromTo(currentImage, 3, { alpha: 1 }, { alpha: 0 }); addChild(currentImage); if (index < urls.length - 1) { index++; } else { index = 0; } TweenLite.delayedCall(3, showNextImage); } var pauseB: pauseBtn = new pauseBtn; addChild(pauseB); pauseB.x = 300; pauseB.y = 100; pauseB.addEventListener(MouseEvent.ROLL_OVER, pause); pauseB.addEventListener(MouseEvent.ROLL_OUT, resume); function pause(): void { pauseB.stop(); pauseB.removeEventListener(TimerEvent.TIMER, showNextImage); TweenMax.pauseAll(true, true); } function resume():void{ }
  2. SlideShow

    I tried to solve it myself for some time... function showNextImage() { trace("image " + index) currentImage = LoaderMax.getContent(urls[index]); currentImage.alpha = 0; //TweenLite.to(currentImage, .5, {alpha:1}); TweenLite.fromTo(currentImage, 5, {alpha:1}, {alpha:0}); addChild(currentImage); if (index < urls.length-1) { index++; } else { index = 0; } TweenLite.delayedCall(3, showNextImage); } ...and I just changed TweenLite.to to .fromTo and timing and it seems working fine.
  3. SlideShow

    Hi I am using this code which I took from this forum somewhere import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; LoaderMax.activate([ImageLoader]); var index:int = 0; var currentImage:Sprite; var urls:Array = ["images/rm_01.jpg","images/rm_02.jpg","images/rm_03.jpg","images/rm_04.jpg", "images/rm_05.jpg","images/rm_06.jpg", "images/rm_07.jpg" , "images/rm_08.jpg" , "images/rm_09.jpg" , "images/rm_10.jpg" , "images/rm_11.jpg" , "images/rm_12.jpg"]; var queue:LoaderMax = LoaderMax.parse(urls,{onComplete:onCompleteHandler,onProgress:onProgressHandler,maxConnections:1,onChildComplete:onChildCompleteHandler}, {alpha:0}); queue.load(); function onCompleteHandler(e:LoaderEvent):void { trace("all images loaded"); showNextImage(); } function onProgressHandler(e:LoaderEvent):void { trace(e.target.progress); } function onChildCompleteHandler(e:LoaderEvent):void { trace(e.target + " loaded"); } function showNextImage() { trace("image " + index) currentImage = LoaderMax.getContent(urls[index]); currentImage.alpha = 0; TweenLite.to(currentImage, .5, {alpha:1}); addChild(currentImage); if (index < urls.length-1) { index++; } else { index = 0; } TweenLite.delayedCall(2, showNextImage); } Some of mine images are not the same size due height and width. Could you please help me, so when the new image coming to show up the previous will start to fading .to(alpha :0)
  4. Tweening each one seperately

    That article "Assign EventListeners to Multiple Movie Clips in a Single Blow! A look at target vs currentTarget" is so cool I am using tons of code and this could help me with the problem I am having and with my huge amount of codes....Thank you very much. I tried to upload the file but it says incorrect file Thank you again and I will in to it. Later after more learning and testing and it is working the way I wished. Thank you very much ))) var cell: phone = new phone; addChild(cell); cell.x = 100; cell.y = 100; //add hand cursor cell.buttonMode = true; cell.useHandCursor = true; //assign eventListeners cell.addEventListener(MouseEvent.MOUSE_OVER, cellOver); function cellOver(e: MouseEvent): void { var high = 4; var low = 1; var randint: Number = Math.floor(Math.random() * (1 + high - low)) + low; var highX = 40; var lowX = 0; var randintX: Number = Math.floor(Math.random() * (1 + highX - lowX)) + lowX; var randintY: Number = Math.floor(Math.random() * (1 + highX - lowX)) + lowX; var myTween: TimelineLite = new TimelineLite(); myTween.append(new TweenMax(e.target, .1, { rotationX: randintX, rotationX: -(randintX), rotationZ: randint, rotationY: randintY, rotationY: -(randintX), ease: Elastic.easeOut })); myTween.append(new TweenMax(e.target, .1, { rotationX: -(randintX), rotationZ: -2, rotationY: -(randintX), ease: Elastic.easeOut })); myTween.append(new TweenMax(e.target, .1, { rotationX: 0, rotationZ: 0, rotationY: 0 })); }
  5. Tweening each one seperately

    Hello Can you please help me to tween each of the _num seperately (of the array), because it tweens all of them at the same time when I roll over them. import com.greensock.*; import com.greensock.easing.*; import flash.events.MouseEvent; var cell: phone = new phone; var _plus: plus = new plus; var _numZeroOne: numZero = new numZero; var _numZeroTwo: numZero = new numZero; var _numZeroThree: numZero = new numZero; var _numFour: numFour = new numFour; var _numTwo: numTwo = new numTwo; var _numThree: numThree = new numThree; var _numSevenOne: numSeven = new numSeven; var _numSevenTwo: numSeven = new numSeven; var _numSevenThree: numSeven = new numSeven; var _numSevenFour: numSeven = new numSeven; var _numNine: numNine = new numNine; var _numFive: numFive = new numFive; cell.x = 100; cell.y = 100; //addChild (cell); var arrayCellNum: Array = new Array(_plus, _numFour, _numTwo, _numZeroOne, _numSevenOne, _numSevenTwo, _numFive, _numZeroTwo, _numSevenThree, _numSevenFour, _numNine, _numThree, _numZeroThree); for (var cl: int = 0; cl < arrayCellNum.length; cl++) { arrayCellNum[cl].addEventListener(MouseEvent.ROLL_OVER, phoneOver); arrayCellNum[cl].buttonMode = true; arrayCellNum[cl].x = 18 * cl; addChild(arrayCellNum[cl]); } function phoneOver(e: MouseEvent): void { for (var tw: int = 0; tw < arrayCellNum.length; tw++) { var high = 4; var low = 1; var randint: Number = Math.floor(Math.random() * (1 + high - low)) + low; var highX = 40; var lowX = 0; var randintX: Number = Math.floor(Math.random() * (1 + highX - lowX)) + lowX; var myTween: TimelineLite = new TimelineLite(); myTween.append(new TweenMax(arrayCellNum[tw], .1, { rotationX: randintX, rotationZ: randint })); myTween.append(new TweenMax(arrayCellNum[tw], .1, { rotationX: -(randintX), rotationZ: -2 })); myTween.append(new TweenMax(arrayCellNum[tw], .1, { rotationX: 0, rotationZ: 0 })); } }
  6. Grid building

    Hello I am using the code from snorkl.tv for grid building. What I am trying to do is to load the grid (and later to mask but for this moment, the grid is either too big, too small or it does some weird stuff) to certain movieclip size. I do not know what I am doing wrong. Let say the container is 400x400px. I did change the code so many times that I was almost crying I am sure I am doing some simple mistake but what? Please. I will post the code I started and I've made some changes. The latest code is looking very confusing at this moment import com.greensock.*; //var numTiles:uint = 96; var numTiles:uint = (container.width / 10)*(container.height / 10); //var cols:uint = 12; var cols:uint = container.width / 10; var rows:uint = numTiles / cols; //var rows:uint = container.height / 10; var hspace:uint = 0; var vspace:uint = 0; var tl:TimelineMax = new TimelineMax(); for (var i = 0; i< numTiles; i++) { var newTile:Tile = new Tile(); newTile.width = cols; newTile.height = rows; var currentCol:uint = i % cols; var currentRow:uint = uint(i / cols); trace("currentCol: " + currentCol + "\tcurrentRow: " + currentRow); //positioning formula newTile.x = newTile.width*.5 + currentCol * (newTile.width + hspace); newTile.y = newTile.height*.5 + currentRow * (newTile.height + vspace); //newTile.x = newTile.width + currentCol ; // newTile.y = newTile.height + currentRow ; newTile.scaleX = newTile.scaleY = 0; newTile.alpha = 0; //TWEEN STYLE FORMULAS: choose ONLY one //column by column //tl.insert( TweenMax.to( newTile, .5, {scaleX:1, scaleY:1, alpha:1, delay:currentCol * .1}) ); //row by row //tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay:currentRow * .1 }) ); //1 by 1 horizontal //tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay:i*.02})); //1 by 1 vertical //tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay:((rows * currentCol) + currentRow) *.02 }) ); //circular tl.insert( TweenLite.to( newTile, .5, { scaleX:1, scaleY:1, alpha:1, delay:(newTile.y * newTile.x)*.00001 }) ); //diagonal top left to bottom right //tl.insert( TweenLite.to( newTile, .5, { scale:1, alpha:1, delay: (currentCol + currentRow) * .05 }) ); //diagonal bottom right to top left //tl.insert(TweenLite.to(newTile, .5, {scale:1, alpha:1, delay: ((numTiles/cols + cols -2)- (currentCol + currentRow)) * .05 })); //END TWEEN STYLES container.addChild(newTile); }
  7. Random Movement

    Hello Carl I've made the flying boxes with your great help and it is working very fine. If you have a minute, can you please take a look at it and tell what do you thing. I wish it would look more "space look" or more space feel... import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; TweenPlugin.activate([TintPlugin]); function randomNumber(min:Number, max:Number):Number { //good return Math.floor(Math.random() * (1 + max - min) + min); } var masterTimeline:TimelineLite = new TimelineLite(); for (var i:int = 0; i<=89; i++) { var childTimeline:TimelineMax = new TimelineMax({repeat:10,yoyo:true}); //get a reference to each movieclip in flyingBoxes var mc:MovieClip = this["bxFl" + i] as MovieClip; //tween to random x and y at same time childTimeline.insertMultiple([ new TweenMax( mc, 2, { x:String(randomNumber(-3, 3)), ease:Bounce.easeOut,alpha:.5, blurFilter:{blurX:String(randomNumber(10, 30)), blurY:String(randomNumber(0, 50))}}), new TweenMax( mc, 2, { y:String(randomNumber(-3, 3)), ease:Bounce.easeIn, blurFilter:{blurX:String(randomNumber(10, 30)), blurY:String(randomNumber(0, 50))}}) ],i*.5); //tween to another randomx and y at same time (after previous tweens occur); childTimeline.appendMultiple([ new TweenMax( mc, 3, { x:String(randomNumber(-3, 3)), ease:Bounce.easeOut,alpha:1, blurFilter:{blurX:0, blurY:0}}), new TweenMax( mc, 1, { y:String(randomNumber(-3, 3)), ease:Bounce.easeIn, blurFilter:{blurX:0, blurY:0}}) ],i*.8); masterTimeline.insert(childTimeline); } [attachment=0]flying_boxes_v10_space.rar[/attachment]
  8. Random Movement

    Well Carl...it's so cool. I played with the code a bit for some time and I think it is something I wished for function randomNumber(min:Number, max:Number):Number { //good return Math.floor(Math.random() * (1 + max - min) + min); } var masterTimeline:TimelineLite = new TimelineLite(); for (var i:int = 0; i<=10; i++) { var childTimeline:TimelineMax = new TimelineMax({repeat:10,yoyo:true}); //get a reference to each movieclip in flyingBoxes var mc:MovieClip = this["box" + i] as MovieClip; //tween to random x and y at same time childTimeline.insertMultiple([ new TweenMax( mc, 1, { x:String(randomNumber(-20, 20)), ease:Bounce.easeOut,alpha:.5, blurFilter:{blurX:String(randomNumber(10, 50)), blurY:String(randomNumber(0, 50))}}), new TweenMax( mc, 2, { y:String(randomNumber(-20, 20)), ease:Bounce.easeIn, blurFilter:{blurX:String(randomNumber(10, 50)), blurY:String(randomNumber(0, 50))}}) ],i*.1); //tween to another randomx and y at same time (after previous tweens occur); childTimeline.appendMultiple([ new TweenMax( mc, 3, { x:String(randomNumber(-20, 20)), ease:Bounce.easeOut,alpha:1, blurFilter:{blurX:0, blurY:0}}), new TweenMax( mc, 1, { y:String(randomNumber(-20, 20)), ease:Bounce.easeIn, blurFilter:{blurX:0, blurY:0}}) ],i*.2); masterTimeline.insert(childTimeline); trace ("position of box1...x ", box1.x, "...y ", box1.y); } I put some delayed time which look more random and some blur and alpha. I will see how it will look in my project but it is working I was hoping for. Thank you very much Let me ask one more question though, please...when I disabled the line "masterTimeline.insert(childTimeline);" in preview I don't see any difference, is it for another loop? why can not see it? or what does it do? Thanks and have a nice Sunday
  9. Random Movement

    Thank you very much Carl for the file and help ...I will try to think more and to modify it to the way I wish or imagine...
  10. Random Movement

    Carl you might to start to hate me but I just noticed the code you wrote me earlier...I did not notice scroller!!! which I feel very stupid now anyway I tried the code with simple boxes which are on the stage...five of them named box1-box5 When I test it...it does nothing and after few milliseconds errors are jumping at me... here is the whole code I did not noticed...sorry... import com.greensock.*; import com.greensock.easing.*; //var boxesFlyingPictures:Array = [boxesFlying.boxesFlying01,boxesFlying.boxesFlying02,boxesFlying.boxesFlying03,boxesFlying.boxesFlying04,boxesFlying.boxesFlying100,boxesFlying.boxesFlying101,boxesFlying.boxesFlying10,boxesFlying.boxesFlying11,boxesFlying.boxesFlying12,boxesFlying.boxesFlying13,boxesFlying.boxesFlying130,boxesFlying.boxesFlying27,boxesFlying.boxesFlying28,boxesFlying.boxesFlying29,boxesFlying.boxesFlying90,boxesFlying.boxesFlying91,boxesFlying.boxesFlying92,boxesFlying.boxesFlying93,boxesFlying.boxesFlying94,boxesFlying.boxesFlying68,boxesFlying.boxesFlying69,boxesFlying.boxesFlying75,boxesFlying.boxesFlying76,boxesFlying.boxesFlying77,boxesFlying.boxesFlying78,boxesFlying.boxesFlying79,boxesFlying.boxesFlying80,boxesFlying.boxesFlying81,boxesFlying.boxesFlying82,boxesFlying.boxesFlying83,boxesFlying.boxesFlying70,boxesFlying.boxesFlying14,boxesFlying.boxesFlying24,boxesFlying.boxesFlying25,boxesFlying.boxesFlying26,boxesFlying.boxesFlying40,boxesFlying.boxesFlying41,boxesFlying.boxesFlying42,boxesFlying.boxesFlying43,boxesFlying.boxesFlying44,boxesFlying.boxesFlying45,boxesFlying.boxesFlying46,boxesFlying.boxesFlying47,boxesFlying.boxesFlying48,boxesFlying.boxesFlying30,boxesFlying.boxesFlying31,boxesFlying.boxesFlying32,boxesFlying.boxesFlying33,boxesFlying.boxesFlying49,boxesFlying.boxesFlying71,boxesFlying.boxesFlying120,boxesFlying.boxesFlying121,boxesFlying.boxesFlying122,boxesFlying.boxesFlying123,boxesFlying.boxesFlying124,boxesFlying.boxesFlying15,boxesFlying.boxesFlying88,boxesFlying.boxesFlying89,boxesFlying.boxesFlying60,boxesFlying.boxesFlying61,boxesFlying.boxesFlying16,boxesFlying.boxesFlying17,boxesFlying.boxesFlying18,boxesFlying.boxesFlying19,boxesFlying.boxesFlying20,boxesFlying.boxesFlying21,boxesFlying.boxesFlying110,boxesFlying.boxesFlying111,boxesFlying.boxesFlying112,boxesFlying.boxesFlying113,boxesFlying.boxesFlying22,boxesFlying.boxesFlying23,boxesFlying.boxesFlying72,boxesFlying.boxesFlying73,boxesFlying.boxesFlying74,boxesFlying.boxesFlying50,boxesFlying.boxesFlying51,boxesFlying.boxesFlying52,boxesFlying.boxesFlying95,boxesFlying.boxesFlying96,boxesFlying.boxesFlying97,boxesFlying.boxesFlying98,boxesFlying.boxesFlying99,boxesFlying.boxesFlying55,boxesFlying.boxesFlying56,boxesFlying.boxesFlying57,boxesFlying.boxesFlying58,boxesFlying.boxesFlying85,boxesFlying.boxesFlying86,boxesFlying.boxesFlying87,boxesFlying.boxesFlying65,boxesFlying.boxesFlying66,boxesFlying.boxesFlying67,boxesFlying.boxesFlying105]; function randomNumber(min:Number, max:Number):Number { //good return Math.floor(Math.random() * (1 + max - min) + min); } var masterTimeline:TimelineLite = new TimelineLite(); for (var i:int = 0; i<=5; i++) { var childTimeline:TimelineMax = new TimelineMax({repeat:10,yoyo:true}); //get a reference to each movieclip in flyingBoxes var mc:MovieClip = ["box"+ i] as MovieClip; //tween to random x and y at same time childTimeline.insertMultiple([ new TweenLite( mc, 2, { x:String(randomNumber(-200, 200)), ease:Bounce.easeOut}), new TweenLite( mc, 2, { y:String(randomNumber(-200, 200)), ease:Bounce.easeOut}) ]); //tween to another randomx and y at same time (after previous tweens occur); childTimeline.appendMultiple([ new TweenLite( mc, 1, { x:String(randomNumber(-200, 200)), ease:Bounce.easeOut}), new TweenLite( mc, 1, { y:String(randomNumber(-200, 200)), ease:Bounce.easeOut}) ]); masterTimeline.insert(childTimeline); }
  11. Random Movement

    OK, here is what I came up with...still it is long way from I wish but I think I am on good track...hopefully... I used some of your codes thanks for the advices...well It seems simple code but I really spent some long time on it var boxesFlyingPictures:Array = [boxesFlying.boxesFlying01,boxesFlying.boxesFlying02,boxesFlying.boxesFlying03,boxesFlying.boxesFlying04,boxesFlying.boxesFlying100,boxesFlying.boxesFlying101,boxesFlying.boxesFlying10,boxesFlying.boxesFlying11,boxesFlying.boxesFlying12,boxesFlying.boxesFlying13,boxesFlying.boxesFlying130,boxesFlying.boxesFlying27,boxesFlying.boxesFlying28,boxesFlying.boxesFlying29,boxesFlying.boxesFlying90,boxesFlying.boxesFlying91,boxesFlying.boxesFlying92,boxesFlying.boxesFlying93,boxesFlying.boxesFlying94,boxesFlying.boxesFlying68,boxesFlying.boxesFlying69,boxesFlying.boxesFlying75,boxesFlying.boxesFlying76,boxesFlying.boxesFlying77,boxesFlying.boxesFlying78,boxesFlying.boxesFlying79,boxesFlying.boxesFlying80,boxesFlying.boxesFlying81,boxesFlying.boxesFlying82,boxesFlying.boxesFlying83,boxesFlying.boxesFlying70,boxesFlying.boxesFlying14,boxesFlying.boxesFlying24,boxesFlying.boxesFlying25,boxesFlying.boxesFlying26,boxesFlying.boxesFlying40,boxesFlying.boxesFlying41,boxesFlying.boxesFlying42,boxesFlying.boxesFlying43,boxesFlying.boxesFlying44,boxesFlying.boxesFlying45,boxesFlying.boxesFlying46,boxesFlying.boxesFlying47,boxesFlying.boxesFlying48,boxesFlying.boxesFlying30,boxesFlying.boxesFlying31,boxesFlying.boxesFlying32,boxesFlying.boxesFlying33,boxesFlying.boxesFlying49,boxesFlying.boxesFlying71,boxesFlying.boxesFlying120,boxesFlying.boxesFlying121,boxesFlying.boxesFlying122,boxesFlying.boxesFlying123,boxesFlying.boxesFlying124,boxesFlying.boxesFlying15,boxesFlying.boxesFlying88,boxesFlying.boxesFlying89,boxesFlying.boxesFlying60,boxesFlying.boxesFlying61,boxesFlying.boxesFlying16,boxesFlying.boxesFlying17,boxesFlying.boxesFlying18,boxesFlying.boxesFlying19,boxesFlying.boxesFlying20,boxesFlying.boxesFlying21,boxesFlying.boxesFlying110,boxesFlying.boxesFlying111,boxesFlying.boxesFlying112,boxesFlying.boxesFlying113,boxesFlying.boxesFlying22,boxesFlying.boxesFlying23,boxesFlying.boxesFlying72,boxesFlying.boxesFlying73,boxesFlying.boxesFlying74,boxesFlying.boxesFlying50,boxesFlying.boxesFlying51,boxesFlying.boxesFlying52,boxesFlying.boxesFlying95,boxesFlying.boxesFlying96,boxesFlying.boxesFlying97,boxesFlying.boxesFlying98,boxesFlying.boxesFlying99,boxesFlying.boxesFlying55,boxesFlying.boxesFlying56,boxesFlying.boxesFlying57,boxesFlying.boxesFlying58,boxesFlying.boxesFlying85,boxesFlying.boxesFlying86,boxesFlying.boxesFlying87,boxesFlying.boxesFlying65,boxesFlying.boxesFlying66,boxesFlying.boxesFlying67,boxesFlying.boxesFlying105]; //generate random num between a min and max value; function randomRange(min:Number, max:Number):Number { return min + (Math.random() * (max - min)); } //how much wiggling / zig zagging var wiggle:Number = randomRange(-5,5); //zig or zag? wiggle = Math.random() > .5 ? - wiggle:wiggle; var time:Number = Math.random() * 3; for (var sem=0; sem{ //record position var tadyX:Number = boxesFlyingPictures[sem].x; var tadyY:Number = boxesFlyingPictures[sem].y; //random position var randP:Number = Math.random() * 3; var timeLineSemTam:TimelineLite = new TimelineLite(); timeLineSemTam.insert(new TweenLite(boxesFlyingPictures[sem],time, {x:tadyX+wiggle,ease:Bounce.easeOut,repeat:-1,repeatDelay:0.2}),sem*.1); timeLineSemTam.append(new TweenLite(boxesFlyingPictures[sem],time, {y:tadyY+wiggle,ease:Bounce.easeOut,repeat:-1,repeatDelay:0.2}),sem*.1); trace("position of wiggle" +wiggle); trace("time"+time); } well now it at least works. The repeat doesn't work for some reason 1) I you can please help me, how can I record the original position of the arrays mc, so it can go back. 2) If I may please... how can be each of the movement of the arrays mc be random...when I trace the random, it same for all of them at this moment.
  12. Random Movement

    Thank you guys for the advices ....I'll give it shot....I let you know what I will come up with
  13. Random Movement

    Hello guys I've this code which is working fine...the issue is... I've got those "boxesFlying.boxesFlying" ...about 70, so I know I've have to use array..? the second issue I've got is that the random is fine but those boxes act same random x and y so I've changed the delay time, but again if I will have to do about 70mc I will be sitting here all night... Can you please help me... to simplify and modify, please var min:Number = -15; var max:Number = 15; var fiveToFive:Number = Math.round(Math.random()*(1+ max - min) + min); var p49:Number = boxesFlying.boxesFlying49.x; var p49Y:Number = boxesFlying.boxesFlying49.y; var p40X:Number = boxesFlying.boxesFlying40.x; var p40Y:Number = boxesFlying.boxesFlying40.y; var boxesFlyingTweenSpace40:TimelineLite = new TimelineLite(); boxesFlyingTweenSpace40.insert(new TweenLite(boxesFlying.boxesFlying40,3,{x:p40X + fiveToFive,ease:Bounce.easeOut})); boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{y:p40Y + fiveToFive,ease:Bounce.easeOut}),-2.5); boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{x:p40X - fiveToFive,ease:Bounce.easeOut}),-2); boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{y:p40Y - fiveToFive,ease:Bounce.easeOut}),-2.5); boxesFlyingTweenSpace40.append(new TweenLite(boxesFlying.boxesFlying40,3,{x:-59.30, y:-46}),-2); var boxesFlyingTweenSpace:TimelineLite = new TimelineLite(); boxesFlyingTweenSpace.insert(new TweenLite(boxesFlying.boxesFlying49,2.5,{x:p49 + fiveToFive,ease:Bounce.easeOut})); boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{y:p49Y + fiveToFive,ease:Bounce.easeOut}),-2.4); boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{x:p49 - fiveToFive,ease:Bounce.easeOut}),-2); boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{y:p49Y - fiveToFive,ease:Bounce.easeOut}),-2.9); boxesFlyingTweenSpace.append(new TweenLite(boxesFlying.boxesFlying49,3,{x:51.50, y:-66}),-2);
  14. Random tween

    Thank you guys, you are the best The tutorial from Svorkl is great too. I tweaked the numbers "x,y" to work well. Now I am trying to move the fireBall (it is the beginnig before the code you helped me with ). I am trying to move the fireBall, so it look it is coming from distance towards you but not straight but in angle.... I found some code here from web site stackoverflow...http://stackoverflow.com/questions/1891397/flash-as3-tweening-at-an-angle so I tried it...myself, but I was changing the numbers but it still goes in line.... var xAngle:Number = 260*Math.cos(26*Math.PI/180); var yAngle:Number = 180*Math.sin(30*Math.PI/180); var timeLineFireBall:TimelineLite = new TimelineLite(); timeLineFireBall.insert(TweenMax.to (fireBallCrashed, 4, {x:xAngle,y:yAngle})); Can be done? I noticed "TweenPlugin.activate([Physics2DPlugin]);" plugin which would do the work perfectly, right?
  15. Random tween

    Hello Can you please help me with to add Random number... var fireBallArray:Array=[fireBallCrashed.fireBallPeace01,fireBallCrashed.fireBallPeace03,fireBallCrashed.fireBallPeace05,fireBallCrashed.fireBallPeace07,fireBallCrashed.fireBallPeace09,fireBallCrashed.fireBallPeace11,fireBallCrashed.fireBallPeace13,fireBallCrashed.fireBallPeace15,fireBallCrashed.fireBallPeace17,fireBallCrashed.fireBallPeace19,fireBallCrashed.fireBallPeace02,fireBallCrashed.fireBallPeace04,fireBallCrashed.fireBallPeace06,fireBallCrashed.fireBallPeace08,fireBallCrashed.fireBallPeace10,fireBallCrashed.fireBallPeace12,fireBallCrashed.fireBallPeace14,fireBallCrashed.fireBallPeace16,fireBallCrashed.fireBallPeace18]; var xNumber=Number; var yNumber=Number; xNumber = Math.round(Math.random()*(1100-900))+900; yNumber= Math.round(Math.random()*(-500 - (-350)))+(-350); TweenMax.allTo(fireBallArray, .8, {y:yNumber,x:xNumber,blurFilter:{blurX:50, blurY:50}}, 0.1); The code is working fine. I am trying to get the random "x" and "y" - like each of the "fireBallArray:Array" get the random x and y, when it is called every 0.1s. At this moment it has random "x" and "y" whole "fireBallArray:Array. How should it be, please? I've got this fireBall peaces in one mc and I am trying to shatter this ball to one direction. My code does the job but it doesn't look too good when all of the peaces go to one "x" and "y". Please...