Jump to content
Search Community

scottiescotsman

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by scottiescotsman

  1. import com.greensock.*; import com.greensock.easing.*; import flash.text.TextField; import flash.display.MovieClip; var spc:Number = 0; var maskWidth:Number = 300; var mc:MovieClip = new MovieClip; addChild(mc); mc.x = 150; mc.y = 10; var tf:TextField = new TextField(); mc.addChild(tf); mc.tf.x = 0; mc.tf.y = 0; mc.tf.text = "0123456789123456789012345678901234567890123456789"; trace(mc.tf.text); scrollWords(); function scrollWords():void { mc.tf.wordWrap = false; mc.tf.autoSize = TextFieldAutoSize.CENTER; if(mc.width >= maskWidth) { goForwardTween(mc); } } function goForwardTween(mc:MovieClip):void { spc = (mc.width/2)-(maskWidth/2); TweenMax.to(mc, 3, {x:spc, delay:1, onComplete:goBackTween, onCompleteParams:[mc] }); } function goBackTween(mc:MovieClip):void { spc = (mc.width/2)-(maskWidth/2); TweenMax.to(mc, 3, {x:-spc, delay:1, onComplete:goForwardTween, onCompleteParams:[mc] }); } Hi sorry ... I not used to posting things :/ here is my fla. I figured out the animation before I posted it but cant get it to work correctly. As the size of the tf & therefore the size of the mc will be dependant on the tf.text, it doesn't report back the correct tf.text.size so cannot in turn correct the animation x values. as shown on the png I posted. Thanks in advance Steven changed code and still not work... but should lol scroller_demo (2).zip
  2. hope this helps you to understand what I am trying to achieve thanks in advance Steven scroller_demo.zip
  3. main_Player.txtScroll.tf.x = 0; main_Player.txtScroll.tf.y = 0; main_Player.txtScroll.x = 166; main_Player.txtScroll.y = 182; main_Player.txtScroll.width = main_Player.txtScroll.tf.width; scrollWords(); function scrollWords():void { main_Player.txtScroll.tf.wordWrap = false; main_Player.txtScroll.tf.autoSize = TextFieldAutoSize.CENTER; if(main_Player.txtScroll.tf.width >= 136) { goForwardTween(tf); } } function goForwardTween(tf:TextField):void { TweenMax.to(tf, 3, {x:248, delay:1, onComplete:goBackTween, onCompleteParams:[tf] }); } function goBackTween(tf:TextField):void { TweenMax.to(tf, 3, {x:-tf.width, delay:1, onComplete:goForwardTween, onCompleteParams:[tf] }); } Hi guys haven't been here in awhile here goes ..... ...basically what I have is a TextField inside a MovieClip, and if the text inside the TextField exceeds a certain size it moves back & forth so that the far right of the MovieClip moves to the far left of the mask and far left of the MovieClip moves to the far right of the mask. But for some reason I cant seem to get it to move it populates the TextField ok .. but wont TweenMax.to functions even if the text is larger than the mask. hope someone can help... Steven
  4. Jamie that doesn't work m8 dial starts @ 12 o'clock [volume = 0] and works great at rotating and changing the volume. With the only problem being it keeps rotating and changing volume even if I rotate < 0 or > 360. the code you had written as it didn't restrict the rotation at all, and if I mouse UP just after 6 o'clock it snapped to 12 o'clock. Sorry to be a nuisance.... plz help Steven
  5. /*********************************************************/ function mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(main_Player.dial); offset = Math.atan2(main_Player.dial.y - this.mouseY, this.mouseX - main_Player.dial.x); r1 = r2 = main_Player.dial.rotation; t1 = t2 = getTimer(); main_Player.dial.addEventListener(Event.ENTER_FRAME, enterFrameHandler); main_Player.dial.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } /*********************************************************/ function mouseUpHandler(event:MouseEvent):void { main_Player.dial.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); main_Player.dial.removeEventListener(Event.ENTER_FRAME, enterFrameHandler); var time: Number = (getTimer() - t2) / 1000; var dif: Number = main_Player.dial.rotation - r2; if (dif != dif % 180) { dif += (dif < 0) ? 360 : -360; } var rVelocity: Number = dif / time; ThrowPropsPlugin.to(main_Player.dial, { throwProps: { rotation: { velocity: rVelocity, resistance: 250, end: getEnd } }, onUpdate: snapEnd, ease: Strong.easeOut }, 10, 0.25, 2); } /*********************************************************/ function getEnd(endValue) { var rotationSnap = 30; return Math.round(endValue / rotationSnap) * rotationSnap; } /*********************************************************/ function snapEnd():void { //volumeTxt.text = String(int(degFromRot(dial.rotation))); } /*********************************************************/ function degFromRot(p_rotInput: Number):Number { var degOutput: Number = p_rotInput; while (degOutput >= 360) { degOutput -= 360; } while (degOutput < 0) { degOutput += 360; } return degOutput; } /*********************************************************/ Tried to figure out how to restrict it to 0-360 ? As I have it working perfectly apart from I can rotate it constantly with no restrictions, as it is a volume controller and needs to stop @ 360 & 0 deg Thanks Steven
  6. I was just wondering can LoaderMax read the header information from a mp3... such as bitrate and other header information. Also how would I display this information ? Tried for weeks to get the albumArt from a mp3 but successfully done it, so the only thing left is the bitrate. I know you can work it out with as3 but it is not accurate enough for me so need it from the mp3 header information. Thanks in advance Steven
  7. yes it works m8 thanks, but not the way I wanted it. is there any way that when I mouse over it, it finishes it's 360 cycle or rotation it is on, rather than snapping to (0) ? Thanks in advance Steven
  8. function mouseOUT(e:MouseEvent):void{ TweenMax.to(menu_MAIN, 2, {rotation:"360", ease:Linear.easeNone, repeat:-1}); } function mouseOVER(e:MouseEvent):void{ TweenMax.killTweensOf(menu_MAIN);; } Hi guys, here is a little problem I have and cant figure out how to solve it say I have a clock hand @ 12 o'clock which rotates constantly until I MOUSE_OVER it, what I am trying to do is when I MOUSE_OVER it I want the clock hand to always stop @ 12 o'clock no mater when I MOUSE_OVER it. Thanks for your help in advance Steven
  9. function yoyo():void{ TweenMax.killTweensOf(yoyo_MC); yoyo_MC.x = 0; yoyo_MC.sndTicker.text = ""+snd.id3.artist; yoyo_MC.sndTicker.autoSize = TextFieldAutoSize.LEFT; var xWidth = int(yoyo_MC.width)-193; TweenMax.to(yoyo_MC, 3, {x:-xWidth, y:155, ease:Sine.easeInOut, repeat:-1, yoyo:true}); } Hi guys I have a mp3 tag text scroller left to right with tweenmax.to .... ..but I cant seem to get it to start at with the left side of text finishing at left point of window x=0, and the right side finishing in the end of the right window x=193. so the text is yo-yoing inside the window. I tried loads of ways but to no avail ... heres what I have that does work but not as I would like Thanks in advance Steven
  10. Yup just what I needed and works a treat for what I needed it for can I restrict it to only go from 0-360 deg ? Thanks Steven
  11. ok now I a super member $99 lol I have downloaded the new plugins and installed them in my flash folder. now just need figure out how to get it to act exactly like the one on webpage Thanks Steven
  12. var dial:Sprite; var radius:Number = 0; var angle:Number = 0; var angleConvert:Number = 180 / Math.PI; init(); function init():void { makeDial(); makeOrb(); } function onMove(e:MouseEvent):void { angle = Math.atan2(mouseY - dial.y, mouseX - dial.x); volumeMC.rotation = angleConvert * angle + 90; } function onOrbDown(e:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove); stage.addEventListener(MouseEvent.MOUSE_UP, onOrbUp); } function onOrbUp(e:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove); stage.removeEventListener(MouseEvent.MOUSE_UP, onOrbUp); } function makeDial():void { dial = new Sprite(); var g:Graphics = dial.graphics; g.lineStyle(2, 0x333333); g.drawCircle(0, 0, radius); dial.x = 170; dial.y = 370; addChild(dial); } function makeOrb():void { volumeMC.buttonMode = volumeMC.useHandCursor = true; volumeMC.addEventListener(MouseEvent.MOUSE_DOWN, onOrbDown); } Hi I have a volumeMC dial that drags and drops great, but I want to use the rotation snap in tweenMax to make this better. All I want it to do is .... 1] drag rotate volumeMC around its own centre from 0-360deg in 10deg intervals. 2] to trace the current rotation value to I can adjust the sound. here is what I have that works but I don't like it ... hope someone can help Steven
  13. Sorry about the posting in wrong section Steven
  14. Hi there I am sort of new to as3 & tweenMax and am wanting some help please. I have a volumeMC that I want to rotate [ drag ] and snap every 10 degrees, stop @ 360deg @ 0deg & return the value it snapped at. please could you help Steven
  15. hi there I am new to GreenSock and have made a gallery with the LoaderMax & Queue's. well the gallery works great but I cant figure out this ..... [10 pics loading inside a container] how do I put a loader bar under each picture that is loading rather than using the same loader bar for all the pictures loaded....here is my as3 code so far ... import com.greensock.*; import com.greensock.loading.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.display.*; import flash.events.MouseEvent; import flash.display.MovieClip; var i:Number = 1; var t:Number; var dir:String = ""; var cont:MovieClip; var queue:LoaderMax = new LoaderMax({maxConnections:1, onChildProgress:imageProgressHandler, onChildComplete:imageCompleteHanlder, onProgress:queueProgressHandler, onComplete:queueCompleteHandler, onError:errorHandler }); dir = "images/"+i; pageNum.text = ""+i; cont = cont_A; displayQueue(); nextBtn.addEventListener(MouseEvent.CLICK, nextPic); prevBtn.addEventListener(MouseEvent.CLICK, prevPic); ////////////////////////////////////////////////////////////////////////////// // DISPLAY QUEUE ////////////////////////////////////////////////////////////////////////////// function displayQueue():void { queue.append(new ImageLoader(dir+"/001.jpg", {container:cont, alpha:0, x:17, y:15, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/002.jpg", {container:cont, alpha:0, x:166, y:15, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/003.jpg", {container:cont, alpha:0, x:315, y:15, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/004.jpg", {container:cont, alpha:0, x:464, y:15, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/005.jpg", {container:cont, alpha:0, x:613, y:15, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/006.jpg", {container:cont, alpha:0, x:17, y:180, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/007.jpg", {container:cont, alpha:0, x:166, y:180, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/008.jpg", {container:cont, alpha:0, x:315, y:180, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/009.jpg", {container:cont, alpha:0, x:464, y:180, estimatedBytes:90000})); queue.append(new ImageLoader(dir+"/010.jpg", {container:cont, alpha:0, x:613, y:180, estimatedBytes:90000})); queue.load(); } ////////////////////////////////////////////////////////////////////////////// // QUEUE PROGRESS HANDLER ////////////////////////////////////////////////////////////////////////////// function queueProgressHandler(event:LoaderEvent):void { totalProgressBar_mc.bar_mc.scaleX = event.target.progress; } ////////////////////////////////////////////////////////////////////////////// // QUEUE COMPLETE HANDLER ////////////////////////////////////////////////////////////////////////////// function queueCompleteHandler(event:LoaderEvent):void { //trace("all images have loaded."); } ////////////////////////////////////////////////////////////////////////////// // ERROR HANDLER ////////////////////////////////////////////////////////////////////////////// function errorHandler(event:LoaderEvent):void { trace("error occured with " + event.target + ": " + event.text); } ////////////////////////////////////////////////////////////////////////////// // IMAGE COMPLETE HANDLER ////////////////////////////////////////////////////////////////////////////// function imageCompleteHanlder(event:LoaderEvent):void { var loadedImage:ContentDisplay = event.target.content; loadedImage.alpha = 0; TweenLite.to(loadedImage, .5, {alpha:1}); } ////////////////////////////////////////////////////////////////////////////// // IMAGE PROGRESS HANDLER ////////////////////////////////////////////////////////////////////////////// function imageProgressHandler(event:LoaderEvent):void { progressBar_mc.bar_mc.scaleX = event.target.progress; } ////////////////////////////////////////////////////////////////////////////// // CHECK [i] ////////////////////////////////////////////////////////////////////////////// function check_i():void { if (i>10){i=1}; if (i<1){i=10}; } ////////////////////////////////////////////////////////////////////////////// // NEXT PICTURE ////////////////////////////////////////////////////////////////////////////// function nextPic(event:MouseEvent):void { check_i(); cont_A.x = 0; cont_A.y = 0; cont_A.width = 760; TweenMax.to(cont_A, 1, {x:0, y:0, width:0}); cont_B.x = 760; cont_B.y = 0; cont_B.width = 0; i++ check_i(); pageNum.text = ""+i; TweenMax.to(cont_B, 1, {x:0, y:0, width:760}); dir = "images/"+i; cont = cont_B; displayQueue(); } ////////////////////////////////////////////////////////////////////////////// // PREVIOUS PICTURE ////////////////////////////////////////////////////////////////////////////// function prevPic(event:MouseEvent):void { check_i(); cont_A.x = 0; cont_A.y = 0; cont_A.width = 760; TweenMax.to(cont_A, 1, {x:760, y:0, width:0}); cont_B.x = 0; cont_B.y = 0; cont_B.width = 0; i-- check_i(); pageNum.text = ""+i; TweenMax.to(cont_B, 1, {x:0, y:0, width:760}); dir = "images/"+i; cont = cont_B; displayQueue(); } ////////////////////////////////////////////////////////////////////////////// // WAIT ////////////////////////////////////////////////////////////////////////////// function wait(t){ stop(); var timer:Timer=new Timer(t,1); timer.addEventListener(TimerEvent.TIMER,waitdone); timer.start(); } ////////////////////////////////////////////////////////////////////////////// // WAIT DONE ////////////////////////////////////////////////////////////////////////////// function waitdone(e:TimerEvent){ e.currentTarget.removeEventListener(TimerEvent.TIMER,waitdone); play(); } //////////////////////////////////////////////////////////////////////////////would I need 10 individual progress bars ? hope someone can help thanks Steven
×
×
  • Create New...