Jump to content
GreenSock

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

kwontae

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by kwontae

  1. Thank you for your consideration. I'm worried about my project. Unfortunately I don't have enough money to hire a professional. But I guess I would work it out if I get a lot of patience with learning AS3 in general. It's a wonder for me to see some problem being solved. AS3 is totally new field to me. I've never written any code before. Thank you again for letting me know the architectural problem with my project. Your advice would be a big help.
  2. Thanks for your quick reply. I tried your way, but some errors occurred. I don't know what's wrong. Here is my code with the "TweenMax.getTweensOf()". I'm not using class as I'm new to AS3. addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_1); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_2); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_3); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_4); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_5); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_6); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_7); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_8); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_9); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_10); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_11); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_12); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_13); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_14); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_15); addEventListener(Event.ENTER_FRAME, btn_EnterFrameHandler_16); function btn_EnterFrameHandler_1(event:Event):void { if (btnspeak.currentLabel == "btnS01+1") { btn01.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:0}); } } function btn_EnterFrameHandler_2(event:Event):void { if (btnspeak.currentLabel == "btnS02+1") { btn02.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:0}); } } function btn_EnterFrameHandler_3(event:Event):void { if (btnspeak.currentLabel == "btnS03+1") { btn03.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:0}); } } function btn_EnterFrameHandler_4(event:Event):void { if (btnspeak.currentLabel == "btnS04+1") { btn04.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:0}); } } function btn_EnterFrameHandler_5(event:Event):void { if (btnspeak.currentLabel == "btnS05+1") { btn05.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:0}); } } function btn_EnterFrameHandler_6(event:Event):void { if (btnspeak.currentLabel == "btnS06+1") { btn06.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-100}); } } function btn_EnterFrameHandler_7(event:Event):void { if (btnspeak.currentLabel == "btnS07+1") { btn07.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-200}); } } function btn_EnterFrameHandler_8(event:Event):void { if (btnspeak.currentLabel == "btnS08+1") { btn08.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-300}); } } function btn_EnterFrameHandler_9(event:Event):void { if (btnspeak.currentLabel == "btnS09+1") { btn09.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-400}); } } function btn_EnterFrameHandler_10(event:Event):void { if (btnspeak.currentLabel == "btnS10+1") { btn10.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-500}); } } function btn_EnterFrameHandler_11(event:Event):void { if (btnspeak.currentLabel == "btnS11+1") { btn11.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-600}); } } function btn_EnterFrameHandler_12(event:Event):void { if (btnspeak.currentLabel == "btnS12+1") { btn12.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-700}); } } function btn_EnterFrameHandler_13(event:Event):void { if (btnspeak.currentLabel == "btnS13+1") { btn13.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-785}); } } function btn_EnterFrameHandler_14(event:Event):void { if (btnspeak.currentLabel == "btnS14+1") { btn14.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-785}); } } function btn_EnterFrameHandler_15(event:Event):void { if (btnspeak.currentLabel == "btnS15+1") { btn15.alpha = 0; TweenLite.to(MovieClip(parent).vertical, 0.5, {x:0, y:-785}); } } function btn_EnterFrameHandler_16(event:Event):void { if (btnspeak.currentLabel == "btnE15+1") { MovieClip(parent).control.playandstop.gotoAndStop(1); btnspeak.gotoAndStop("btnS01-1"); } } infi07.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler_7); function mouseDownHandler_7(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_7); mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; isClick = true; TweenLite.delayedCall(clickTime, notClick_7); } function notClick_7():void { isClick = false; } function mouseUpHandler_7(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_7); if (isClick && Math.abs(mouseDownX - stage.mouseX) < 22 && Math.abs(mouseDownY - stage.mouseY) < 22) { if (infi07.currentLabel == "play") { if (check07.selected == false) { for (i = 0; i < checks.length; i++) { checks.selected = false; } } for (i = 0; i < btns.length; i++) { if (i == 6) { continue; } btns.alpha = 1; } btn07.alpha = 0; btnspeak.alpha = 0; MovieClip(parent).control.playandstop.gotoAndStop(1); btnspeak.gotoAndPlay("btnS07"); infi07.gotoAndStop(2); for (var i:int = 0; i < infis.length; i++) { if (i == 6) { continue; } infis.gotoAndStop(1); } } else if (infi07.currentLabel == "pause") { btnspeak.stop(); infi07.gotoAndStop(1); } addEventListener(Event.ENTER_FRAME, fl_InfiFrameHandler_7); } function fl_InfiFrameHandler_7(event:Event):void { if (btnspeak.currentLabel == "btnE07" && check07.selected == false) { btnspeak.gotoAndPlay("btnS07"); } if (infi07.currentLabel == "play") { removeEventListener(Event.ENTER_FRAME, fl_InfiFrameHandler_7); } else if (btnspeak.currentLabel == "btnE07" && check07.selected == true) { removeEventListener(Event.ENTER_FRAME, fl_InfiFrameHandler_7); addEventListener(Event.ENTER_FRAME, infiBoxHandler_7); function infiBoxHandler_7(event:Event):void { TweenMax.getTweensOf(event.currentTarget); var i:int = 6; while (i < checks.length ) { i++; if (btnspeak.currentLabel == btnENums && checks.selected == false) { btnspeak.gotoAndPlay("btnS07"); } } if (infi07.currentLabel == "play") { removeEventListener(Event.ENTER_FRAME, infiBoxHandler_7); TweenMax.getTweensOf(event.currentTarget)[0].pause(); } } } } TweenLite.killDelayedCallsTo(notClick_7); }
  3. Hi Greensock I'm using the TweenLite on my timeline. I killed the TweenLite with "TweenLite.killTweensOf" but I'd like to remove the "TweenLite.killTweenOf" to return to the original TweenLite. I'd like to insert some code to remove "TweenLite.killTweenOf" after the code below "if (infi01.currentLabel == "play")" I want my Tween to be reborn. If you can help me again, it would be much appreciated. addEventListener(Event.ENTER_FRAME, infiBoxHandler_1); function infiBoxHandler_1(event:Event):void { TweenLite.killTweensOf(event.currentTarget); var i:int = 0; while (i < checks.length ) { i++; if (btnspeak.currentLabel == btnENums[i] && checks[i].selected == false) { btnspeak.gotoAndPlay("btnS01"); } } if (infi01.currentLabel == "play") { removeEventListener(Event.ENTER_FRAME, infiBoxHandler_1); }
  4. Thank you very much. It helped a lot!!!
  5. Thank you very much. I will try..
  6. That's right. I want my scrolling faster. Do you mean I can increase the maxDuration value to increase the velocity? I guess so. Thank you very much.
  7. Hi Greensock I've made a scroll helped by the power the ThrowPropsPlugin. I'm really satisfied with the smooth scrolling. But I'm still hungry. When I scroll down mine on my i-phone, it's not as speedy as the ios scrolling. If you know any way to speed up my scroll, I'd like to know the secret. Here is my code for the scroll. import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; import flash.geom.Rectangle; import flash.utils.getTimer; import flash.events.MouseEvent; import flash.text.*; import flash.display.*; TweenPlugin.activate([ThrowPropsPlugin]); var bounds:Rectangle = new Rectangle(0,0,1024,556); graphics.beginFill(00000000, 1); graphics.drawRect(bounds.x, bounds.y, bounds.width, bounds.height); graphics.endFill(); stop(); //here is where I reference the MovieClip.; var mc:MovieClip = vertical; var blitMask:BlitMask = new BlitMask(mc,bounds.x,bounds.y,bounds.width,bounds.height,false); blitMask.bitmapMode = false; var t1:uint,t2:uint,y1:Number,y2:Number,yOverlap:Number,yOffset:Number; blitMask.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { TweenLite.killTweensOf(mc); y1 = y2 = mc.y; yOffset = this.mouseY - mc.y; yOverlap = Math.max(0,mc.height - bounds.height); t1 = t2 = getTimer(); mc.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); mc.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } function mouseMoveHandler(event:MouseEvent):void { var y:Number = this.mouseY - yOffset;//if mc's position exceeds the bounds, make it drag only half as far with each mouse movement (like iPhone/iPad behavior) if (y > bounds.top) { mc.y = (y + bounds.top) * 0.5; } else if (y < bounds.top - yOverlap) { mc.y = (y + bounds.top - yOverlap) * 0.5; } else { mc.y = y; } blitMask.update(); var t:uint = getTimer();//if the frame rate is too high, we won't be able to track the velocity as well, so only update the values 20 times per second if (t - t2 > 50) { y2 = y1; t2 = t1; y1 = mc.y; t1 = t; } event.updateAfterEvent(); } function mouseUpHandler(event:MouseEvent):void { mc.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); mc.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); var time:Number = (getTimer() - t2) / 1000; var yVelocity:Number = (mc.y - y2) / time; ThrowPropsPlugin.to(mc, {throwProps:{ y:{velocity:yVelocity, max:bounds.top, min:bounds.top - yOverlap, resistance:300} }, onUpdate:blitMask.update, ease:Strong.easeOut }, 10, 0.3, 1); }
  8. No problem. Thank for your reply. Next time, I will post only regarding of the GreenSock Animation.
  9. I need some help. I'm new to ActionScript and my code looks too long. If I make more button and checkbox, it would be much longer. I'm sure there is some way to make it shorter. So if anyone can help me, it would be much appreciated. Here is my code. var checks:Array = [check01,check02,check03,check04,check05,check06,check07,check08,check09,check10,check11,check12,check13,check14,check15,check16,check17,check18,check19]; var btnENums:Array = ["btnE01","btnE02","btnE03","btnE04","btnE05","btnE06","btnE07","btnE08","btnE09","btnE10","btnE11","btnE12","btnE13","btnE14","btnE15","btnE16","btnE17","btnE18","btnE19"]; addEventListener(Event.ENTER_FRAME, checkBoxHandler_1); function checkBoxHandler_1(event:Event):void { if (btnspeak.currentLabel == "btnE02" && check02.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE03" && check03.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE04" && check04.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE05" && check05.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE06" && check06.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE07" && check07.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE08" && check08.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE09" && check09.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE10" && check10.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE11" && check11.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE12" && check12.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE13" && check13.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE14" && check14.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE15" && check15.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE16" && check16.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE17" && check17.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE18" && check18.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } else if (btnspeak.currentLabel == "btnE19" && check19.selected == false) { btnspeak.gotoAndStop("btnS01-1"); MovieClip(parent).control.playandstop.gotoAndStop(1); } if (btnspeak.currentLabel == "btnS01-1") { removeEventListener(Event.ENTER_FRAME, checkBoxHandler_1); } }
  10. Thank you so much Jamie! It worked well on my computer and the galaxy tab 10.1 but not on my iPad. It's weird that the same code responses differently. One more question! I have 16 buttons inside the scroll. When I click the first button(btn01), the first movieclip(btnspeak01) should play and the rest 15 movieclips should stop. And then I click the second button(btn02), the btnspeak02 should play immediately. But clicking the btn02 only stop all other buttons. I have to click the btn02 twice to play the btnspeak02. I guess this problem is related to "fl_ToLoad:Boolean = true;". But I can't find the solution. Here is the code below only for the 5 buttons. I'm sure that the code for the 16 buttons will be extremely long. I guess there should be a way to make it shorter. If you can help me about that, I'd appreciate it if you help me. import com.greensock.*; import com.greensock.easing.*; import com.greensock.plugins.*; var btnspeak:Array = [btnspeak01,btnspeak02,btnspeak03,btnspeak04,btnspeak05,btnspeak06,btnspeak07,btnspeak08,btnspeak09,btnspeak10,btnspeak11,btnspeak12,btnspeak13,btnspeak14,btnspeak15,btnspeak16]; for (var i:uint = 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } var btns:Array = [btn01,btn02,btn03,btn04,btn05,btn06,btn07,btn08,btn09,btn10,btn11,btn12,btn13,btn14,btn15,btn16]; var mouseDownX:Number;//for recording the x position of the mouse when it is pressed var mouseDownY:Number;//for recording the y position of the mouse when it is pressed var clickedButton:DisplayObject;//for recording the button that is pressed var isClick:Boolean = false; var clickTime:Number = 0.5; var fl_ToLoad:Boolean = true; btn01.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function mouseDownHandler(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; isClick = true; TweenLite.delayedCall(clickTime, notClick); } function notClick():void { isClick = false; } function mouseUpHandler(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); if (isClick && Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) { clickHandler(clickedButton); } TweenLite.killDelayedCallsTo(notClick); } function clickHandler(button:DisplayObject):void { if (fl_ToLoad) { btnspeak01.play(); for (var i:uint = 0; i>1 && i < btnspeak.length; i++) { btnspeak[i].stop(); } } else { for (i= 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } } fl_ToLoad = ! fl_ToLoad; } btn02.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler_2); function mouseDownHandler_2(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_2); mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; isClick = true; TweenLite.delayedCall(clickTime, notClick); } function notClick_2():void { isClick = false; } function mouseUpHandler_2(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_2); if (isClick && Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) { clickHandler_2(clickedButton); } TweenLite.killDelayedCallsTo(notClick); } function clickHandler_2(button:DisplayObject):void { if (fl_ToLoad) { btnspeak02.play(); btnspeak01.stop(); for (var i:uint = 0; i>2 && i < btnspeak.length; i++) { btnspeak[i].stop(); } } else { for (i= 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } } fl_ToLoad = ! fl_ToLoad; } btn03.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler_3); function mouseDownHandler_3(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_3); mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; isClick = true; TweenLite.delayedCall(clickTime, notClick); } function notClick_3():void { isClick = false; } function mouseUpHandler_3(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_3); if (isClick && Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) { clickHandler_3(clickedButton); } TweenLite.killDelayedCallsTo(notClick); } function clickHandler_3(button:DisplayObject):void { if (fl_ToLoad) { btnspeak03.play(); btnspeak01.stop(); btnspeak02.stop(); for (var i:uint = 0; i>3 && i < btnspeak.length; i++) { btnspeak[i].stop(); } } else { for (i= 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } } fl_ToLoad = ! fl_ToLoad; } btn04.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler_4); function mouseDownHandler_4(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_4); mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; } function mouseUpHandler_4(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_4); if (Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) { clickHandler_4(clickedButton); } } function clickHandler_4(button:DisplayObject):void { if (fl_ToLoad) { btnspeak04.play(); btnspeak01.stop(); btnspeak02.stop(); btnspeak03.stop(); for (var i:uint = 0; i>4 && i < btnspeak.length; i++) { btnspeak[i].stop(); } } else { for (i= 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } } fl_ToLoad = ! fl_ToLoad; } btn05.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler_5); function mouseDownHandler_5(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_5); mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; } function mouseUpHandler_5(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler_5); if (Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) { clickHandler_5(clickedButton); } } function clickHandler_5(button:DisplayObject):void { if (fl_ToLoad) { btnspeak05.play(); btnspeak01.stop(); btnspeak02.stop(); btnspeak03.stop(); for (var i:uint = 0; i>4 && i < btnspeak.length; i++) { btnspeak[i].stop(); } } else { for (i= 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } } fl_ToLoad = ! fl_ToLoad; }
  11. Hi Jack I got your help last time in solving the conflict problem between clicking my movie-clip and dragging the scroll. If the mouse has moved less than 3 pixels in either direction when the mouse is released, I can click the movie-clips inside the scroll. Otherwise I can drag the scroll. It works well with mouse. But when I drag slowly with my finger on my iPad and stop on a movie clip, the last touch triggers clicking. I guess the touch is a long press touch. So I assume that if I make the long press touch not trigger clicking, it would be much better. I hope it would act more like the IOS scrolling which is clickable only when the time and length of the touch are all short. I'd like to insert another condition regarding about the time. How about that when the touch lasts less than 0.5 second, treat it as a click otherwise ignore it? I have been studied the Action-script 3.0 for the last couple of weeks but I couldn't find a clue about the code. Could you give me some help about the code? Here is the code you gave me last time. And I attached the FLA file. Thank you so much. var btnspeak:Array = [btnspeak01,btnspeak02,btnspeak03,btnspeak04,btnspeak05,btnspeak06,btnspeak07,btnspeak08,btnspeak09,btnspeak10,btnspeak11,btnspeak12,btnspeak13,btnspeak14,btnspeak15,btnspeak16]; for(var i:uint = 0; i < btnspeak.length; i++) { btnspeak[i].stop(); } var btns:Array = [btn01, btn02, btn03, btn04, btn05, btn06, btn07, btn08, btn09, btn10, btn11, btn12, btn13, btn14, btn15, btn16]; var mouseDownX:Number; //for recording the x position of the mouse when it is pressed var mouseDownY:Number; //for recording the y position of the mouse when it is pressed var clickedButton:DisplayObject; //for recording the button that is pressed for (i = 0; i < btns.length; i++) { btns[i].addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } function mouseDownHandler(event:MouseEvent):void { stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); //now record the mouse position and button that's pressed mouseDownX = stage.mouseX; mouseDownY = stage.mouseY; clickedButton = event.target as DisplayObject; } function mouseUpHandler(event:MouseEvent):void { stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); //if the mouse has moved less than 3 pixels in either direction when the mouse is released, treat it as a click. Otherwise ignore it. if (Math.abs(mouseDownX - stage.mouseX) < 3 && Math.abs(mouseDownY - stage.mouseY) < 3) { clickHandler(clickedButton); } } function clickHandler(button:DisplayObject):void { for (var i:int = 0; i < btns.length; i++) { if (btns[i] != button) { btns[i].gotoAndStop(1); } } } question_about_the longpressed_time.zip
  12. Jack, thank you so much. Your solution sounds awesome. I was wondering how I can make the scroll like the IOS scroll. Now I know the secret thanks to you. And I was stunned by the only four lines with which you had simplified the hundreds of lines. Let me fix the problem with your solution. Have a good weekend!
  13. Hi Jack I was surprised to discover the amazing site, GreenSock and feel secured because I'm a novice in AS3. I gladly signed up. I hope this membership will help me learning AS3. I got stuck on my first project, making the clickable scroll for my NewiPad. I inserted my clickable movie-clip (vertical) inside the code from the Flick-scrolling example and tested the scroll on my New iPad. It worked well but the problem is that clicking my movie-clip and dragging the scroll conflict. When I scroll, I only want it to trigger the scroll event. Right now mouse click event and scroll event are firing at the same time. So I switched all the mouse click events into the touch events but still the same problem occurs. I only want that click event or touch event fired when I tap the button not drag the scroll. Your help will be much appreciated. Thanks. question_about_coflict01.zip
×