473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Flex MouseEvent.MOUSE_UP MouseEvent.MOUSE_DOWN & listeners detect hold down mouse

16
Hi everyone,

Yes, I need to use you guys as a sounding board once more :-)

I have a button that has two listeners one for mouse up and the other for mouse down and they point to the same function.

Expand|Select|Wrap|Line Numbers
  1. $btnRewind.addEventListener(MouseEvent.MOUSE_DOWN,onBtnBack);
  2. $btnRewind.addEventListener(MouseEvent.MOUSE_UP,onBtnBack);
  3.  
I want the end user to keep holding down their mouse to rewind and when they release the mouse, then I want the while loop to break.

As you can see by the code below, I've been trying a ton of stuff and I've commented out all the stuff that I'm not currently using

Expand|Select|Wrap|Line Numbers
  1.     private function onBtnBack(event:MouseEvent) : void
  2.     {
  3.         myCurrentPlayHead = Number($video.time);
  4.         //trace("$video.timecode "+$video.timecode);
  5.         //trace("$video.time "+$video.time);
  6.         //trace("event "+event);
  7.         //trace("myCurrentPlayHead "+myCurrentPlayHead);
  8.         //myConvertTime = String($video.timecode);
  9.         //myConvertTimeArray = myConvertTime.split(/:/);
  10.         //myCounterSec = Number(myConvertTimeArray[2]);
  11.         //myCounterFrames = Number(myConvertTimeArray[3]);
  12.         //myActualSeconds = myCounterSec * $video.fps;
  13.         //myActualFrames = myActualSeconds + myCounterFrames;
  14.         //trace("myActualFrames "+myActualFrames);
  15.         //myEndTime = Number($video.stream_end_time);
  16.         //trace("myEndTime "+myEndTime);
  17.  
  18.  
  19.         while(myCurrentPlayHead>0 && event.type == "mouseDown")
  20.         {
  21.             if(event.type == "mouseUp")
  22.             {
  23.                 break;
  24.             }
  25.             else
  26.             {
  27.                 myCurrentPlayHead = myCurrentPlayHead - 0.05;
  28.                 trace("myCurrentPlayHead rwnd "+myCurrentPlayHead);
  29.                 my_timedProcess = setTimeout(my_rewindFunction,1000/$video.fps);                
  30.             }
  31.         }
  32.  
  33.     }
  34.  
  35.     public function my_rewindFunction():void
  36.     {
  37.         if(myCurrentPlayHead > 0)
  38.         {
  39.             $video.pause();
  40.             $video.seek(myCurrentPlayHead);                
  41.         }
  42.     }
  43.  
Within the while loop, I have an if statement that basically checks for a mouseUp event, but it's like the function has already passed the event.type == "mouseDown" to the while loop, which means that the event.type == "mouseUp" will not arrive until the while loop has completed it's infinite loop.

BTW, speaking of infinite loops, I am tracing the var myCurrentPlayHead and it always goes below 0 into negative numbers, but the while loop still doesn't break.

Please help, I'm at a loss -- this should work.

Thanx n advance
Dec 18 '08 #1
0 4983

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Alexandre Jaquet | last post by:
Hi, I would like to copy and paste a selected item on a web page I already 've a context menu when the user rigth click on an item. I would like to draw a rectangle who carry about current...
1
by: Dino M. Buljubasic | last post by:
I am trying to get coordinates of mouse_down/mouse_up event BUT relevant to the form or the parent of a control, not to the control where mouse click has occured. That means, even if I click a...
2
by: Michael Powe | last post by:
Hello, Is there a way (in JS) to detect listeners on an element and identify them? The purpose would be to selectively attach additional listeners if certain conditions are met. For example, I...
5
by: Daniel N. | last post by:
I am trying have an application hold down the Shift key (+) and the Alt key (%) simultaneously for a given period of time, or until a condition is met. I tried this but it doesn't work:...
6
by: Eric Layman | last post by:
Is there a way to detect a held-down button while the mouse is moving? Thanks. Posted Via Usenet.com Premium Usenet Newsgroup Services
5
by: ASP.NET explorer | last post by:
I have been asked to create some simple animation using Adobe Flash player in ASP.NET(C#) web application. While I am fairly well versed with ASP.NET C#, I absolutely have NO IDEA about how to...
0
by: jibysubhash | last post by:
hi all i have got a php code which sends attachments via mail..... Please help me how to send the file parameters to the php via http service send method.... i am placing the php and flex codes here ...
3
by: panteraboy | last post by:
Hey there again byters .My previous post was called click & hold(need info). I thought i had solved the problem but after testing i realise that its no doing what its supposed to. i wished to open...
3
by: kronus | last post by:
Hi Everyone, It's been a long time and I'm always appreciative of your help. I'm working on a Datagrid at the component level in Flex. I know that I can expand a row within the Datagrid by...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.