Wait on a frame
Hi,
Is there a way to wait for say 10 seconds on a frame, then
automatically jump to the next frame? I thought I could do it using
setTimeout or setInterval somehow, but can't seem to get it to
work. Thanks.
Bob
BobMelnyk,
> Is there a way to wait for say 10 seconds on a frame,
> then automatically jump to the next frame? I thought
> I could do it using setTimeout or setInterval somehow,
> but can't seem to get it to work.
That's the approach I'd use. :)
See
http://www.quip.net/blog/2006/flash/how-to-pause-timeline
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design."
Similar Messages
-
How do I optimize "Waiting for the next frame"
When running my swf file in release build, the first time I start the browser after cleaning the browser cache, the .swf will appear in less than a second. If I attach scout, I can see it is around .7 seconds to finish.
However, after this run all subsequent times I load the page, it takes ~3 seconds.
When I look at scout, I see almost identical CPU and memory use , but it is spending ~2.3 seconds "Waiting for the next frame". (almost an extra 700ms per frame).
There is no requirement for animation, all of the content is very static. I'd just like to render it as fast as possible.
I know it's not related to caching the .swf file because I have tried turning off the caching (by adding a random parameter) and verified using Httplogger that it is always downloading a new .swf file. (I turned back on caching). So I'm kind of not sure what to do next...
What things can I try to optimize this? Are there places I can read about this issue?
(P.S. >> I notice it spends a lot more time "Waiting for the next frame" when I build a debug version. Don't know if that's relevant...)
Thanks!There's nothing you can do about "Waiting for next frame" - this is simply the time when Flash Player has finished doing everything it needs to do for the frame, and waiting for the OS to wake it up again. This depends on the framerate you set in your swf - roughly speaking, the waiting time is the budget (1/framerate), minus the time Flash Player spends doing actual work.
You can find more information here, about understanding how the data you see in Scout relates to how Flash Player works:
http://www.adobe.com/devnet/scout/articles/understanding-flashplayer-with-scout.html
btw, you shouldn't look at performance in a debug swf - you'll get wildly misleading results. -
Wait on frame until video finishes?
Hello,
Does anyone know if there's a way to tell flash to wait on a
frame until a video finishes playing, and then go to the next
frame? (I'm using progressive download. It has audio that needs to
stay in sync.)
Thank you for your help!kalibahlutwo,
> I have imported an FLV and on import chose
"progressive",
> rather than embedding the video, because I read that if
the
> video has audio in it, it will stay syncronized better
with
> progressive than with embedded video.
I can neither confirm nor deny which plays better. But it's
good to
know we're dealing with external video.
> Flash automatically put the video into an FLVPlayback
> component.
Yupper. :) Now we're getting warmer.
> I would like to have the video play to the end, and then
> have the Flash movie automatically go to the next frame.
Here's the scoop. Just about everything in ActionScript can
be
described as an object. Objects are defined by something
called classes,
which you may think of as object blue prints. The FLVPlayback
Component,
for example, is defined by the FLVPlayback class, and you can
look up this
class entry in your documentation. Components are listed in
the Component
Language Reference and ActionScript clases are listed in the
ActionScript
2.0 Language Reference.
Classes define the properties of an object (the
characteristics it has),
its methods (things it can do), and its events (things it can
react to). So
class entries should definitely be your first stop, always.
If you're
dealing with a movie clip, look up the MovieClip class. If
you're dealing
with a dynamic or input text field, look up the TextField
class, and so on.
Consulting the FLVPlayback class, then, we find that
"FLVPlayback
extends the MovieClip class and wraps a VideoPlayer object.."
Okay, what
does that mean? Well, in this context, it means that any
FLVPlayback
instance -- such as the one on your Stage -- contains all the
features
(properties, methods, and events) of a movie clip, because it
*extends* the
MovieClip class. So this particular case is something of a
wild goose
chase. Normally, the answers you want are already at hand.
FLVPlayback is
a little different. But the documentation continues: "... and
wraps a
VideoPlayer object," so now we know to get more information
by looking up
the VideoPlayer class.
Bingo. Here's were we find the answer. The VideoPlayer class
includes
an event VideoPlayer.complete (see the Events summary in its
class entry).
It also contains a method VideoPlayer.addEventListener(),
which means we can
"listen" for the complete event. Good news.
So ... give your FLVPlayback Component instance an instance
name.
Select it and look at the Property inspector. Let's name it
vp, short for
video player. Create a new layer and name it "scripts" --
this is where
we'll put your ActionScript.
var listener:Object = new Object();
listener.complete = function() {
trace("complete!");
vp.addEventListener("complete", listener);
Here's what's going on. Events of the sort we're dealing
with can be
handled with a listener. A listener is just a generic Object
instance -- so
in line 1, we're declaring a variable arbitrarily named
listener. It's of
type Object and is set to a new Object instance.
This listener object acts as a proxy for the FLVPlayer
(actually, the
VideoPlayer) complete event. Via this listener, we assign a
function to a
complete property. In this example code, I'm simply having it
trace() the
string "complete!" to the Output panel. You'll want to have
it send the
main timeline to frame 2 -- _root.gotoAndStop(2);
Finally, our FLVPlayer instance, vp, invokes the
VideoPlayer.addEventListener() method to become a listener
for "complete"
events from the listener object.
Done. Badda bing. :)
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design." -
I am trying to make the movie play random frames when it is
opened using the following script:
gotoAndStop(random(13)+2);
I managed to do this successfully using numbers in each frame
to see where the movie was but then found that when I added
content(images and movie clips) to the frames a blank screen (that
didn't exist )kept appearing at random intervals and some of the
content in certain frames was missing.
Does anyone know why this is or have an alternative script or
method I can use for the randomisation i need?
p.s I am using Flash 8You have to wait until a frame is loaded before you can go to
it.
In the first frame:
// wait for all frames to load before jumping to random
this.onEnterFrame = function(){
if(this._framesloaded == this._totalframes){
this.onEnterFrame = undefined;
this.gotoAndStop(random(13)+2);
Alternatively, you could check if a range of frames is
loaded:
this.onEnterFrame = function(){
if(this._framesloaded >= aframenumber){...}
"Dilroy" <[email protected]> wrote in
message
news:e2o0s5$l61$[email protected]..
> I am trying to make the movie play random frames when it
is opened using
the
> following script:
>
> gotoAndStop(random(13)+2);
>
> I managed to do this successfully using numbers in each
frame to see
where the
> movie was but then found that when I added
content(images and movie clips)
to
> the frames a blank screen (that didn't exist )kept
appearing at random
> intervals and some of the content in certain frames was
missing.
>
> Does anyone know why this is or have an alternative
script or method I
can use
> for the randomisation i need?
>
> p.s I am using Flash 8
>
> -
Wait function? or something
Hello. I've developed a .mp3 player, and would like it to
continue to the next song as it plays through the music. Here is a
link:
audioPlayer.
I need to figure out how to make the timeline wait on one
frame a number of seconds before it executes the next script. Any
help would be appreciated.
Thank you,
Johndon't forget to clearInterval otherwise it keeps on going :-)
JG
"kglad" <[email protected]> wrote in message
news:ejpt4v$c77$[email protected]..
> the setInterval() function is ideal for this task. -
IOS 8.1+ Performance Issue
Hello,
I encountered a serious performance bug in Adobe Air iOS application on devices running iOS 8.1 or later. Approximately in 1-2 minutes fps drops to 7 or lower without interacting with the app. This is very noticeable in the app. The app looks like frozen for about 0.5 seconds. The bug doesn't appear on every session.
Devices tested: iPad Mini iOS 8.1.1, iPhone 6 iOS 8.2. iPod Touch 4 iOS 6 is working correctly.
Air SDK versions: 15 and 17 tested.
I can track the bug using Adobe Scout. There is a noticeable spike on frame time 1.16. Framerate drops to 7.0. The App spends much time on function Runtime overhead. Sometimes the top activity is Running AS3 attached to frame or Waiting For Next Frame instead of Runtime overhead.
The bug can be reproduced on an empty application having a one bitmap on stage. Open the app and wait for two minutes and the bug should appear. If not, just close and relaunch the app.
Bugbase link: Bug#3965160 - iOS 8.1+ Performance Issue
Miska SavelaHi
Id already activated Messages and entered the 6 digit code I was presented with into my iPhone. I can receive txt messages from non iOS users on my iMac and can reply to those messages.
I just can't send a new message from scratch to a non iOS user :-s
Thanks
Baz -
Hold a JFrame for a number of seconds
I am experimenting with JFrames to get ahead on my project, but one thing is holding me back and I want to know if it possible. Can you have a frame come up on the screen for a number of seconds and then disappear and continue with the rest of the program? For example, say you are opening up a calculator. You run the program and it pops up with a welcome header. You want this header to display for, say 10 seconds, and then disappear and continue on to dislay the working calculator for the user. I am not into applets yet if that should make any kind of difference.
so you want a slash screen, yes you can.
frame.show();shows the frame, and
frame.hide();will hide the frame.
The easyest way would be
frame.show();
Thread.currentThread().sleep(1000 * 60 * 10); // wait 10 seconds.
frame.hide();However if you do this, you can not be setting up the second window, so something like
class HideFrameTask extends java.util.TimerTask {
JFrame hideMe;
public HideFrameTask ( JFrame hideMe ) {
this.hideMe = hideMe;
public void run() {
hideMe.hide();
frame.show();
java.util.Timer timer = new java.util.Timer();
timer.schedule( new HideFrameTask( frame ), 1000 * 60 * 10 );
// make second frame -
Need help with automatic slideshow
I made an automatic slideshow that switches frames at a set
interval but now i want to load each frame from an extrenal swf and
add a preloader for each frame, how do i tell the slideshow to wait
until the frame is loaded before it proceeds to the next frame, but
still have the movieclip be automatic. Also the slideshow can be
controlled mannually so i also want to know how to disable the
manual control till each frame is loaded.Here is some of the action script for the slideshow.
This first bit sets up the automatic interval transitions in
the main movie timeline
function nextImage()
mc_slide.mc_transition.play();
} // End of the function
function waitImage()
clearInterval(slideTimer);
var slideTimer = setInterval(nextImage, timer * 1000);
nextImage();
} // End of the function
function pauseSlide()
mc_slide.mc_quicktransition.gotoAndPlay(2);
} // End of the function
var timer = 8;
var pauseTime = 20;
var slideTimer = setInterval(nextImage, timer * 2000);
stop ();
the movieclip loaders that load each movie clip are embedded
with the transition animation.
this is the code in the embedded mc-it loads the 1st movie
clip and allows the user to manually jump to any of the other movie
clips.
emptyMC.loadMovie("frame1.swf");
var pageAddress = "about:blank";
btn1.onRelease = function ()
_parent.pauseSlide();
gotoAndStop(1);
btn2.onRelease = function ()
_parent.pauseSlide();
gotoAndStop(2);
btn3.onRelease = function ()
_parent.pauseSlide();
gotoAndStop(3);
btn4.onRelease = function ()
_parent.pauseSlide();
gotoAndStop(4);
stop();
I need to know how to put the code for the automation of the
slideshow pause until each movieclip has finished loading and also
at the same time disable the manual control of the movie clips
before they are fully loaded. -
Hi how do I set focus on a textfield after i validate the data. If the validation fails, I want to setFocus on the text field that failed validation. Is there a way I can do this.
Dear nbruckelmyer
If your get getMsgBox(); calls a frame or a non modal dialog then u will have to use
public void getMsgBox() {
.. display the box.
//after ok button pressed.
dispose();
//then requestfocus
lengthTextField.requestFocus();
}Why? . Because after calling the frame/dialog, it doesn't wait for the frame/dialog to be closed so coding it after the frame/dialog is dispose should work
But if you use JOptionPane or modal dialog
then this should work
getMsgBox();
//then I requestFocus
lengthTextField.requestFocus();But if you still have problem, u may post your code minus the contents or simplified version so that it will be easier for us to help u
Thanks
Joey -
Best method for keyframing with 3d camera 1 shot....
Hi I have a project I am working on and basically I am finding the key framing a little frustrating because I cant get the camera to do what I want. Ususally I have no problem in FCP but with Motion it doesnt seem as easy. Bascially what I have done is put up 7 of the same clip all in 3d spread down. What I want the camera to do is zoom close to one. Pause while you read what is on the clip then pan and zoom to the next one. The method I am doing is I hit the record button. Start the zoom to the first object then move timeline to where I want the camera to stop the zoom. I hit the record button again..wait a few frames and then hit it again so I can zoom to the next object. What seems to hahppen is the camera just starts moving to the other object and wont pause for those frames. I would like to know the best method for making this possible.Thanks
hi,
edit them all! Just select them all and choose linear from the control pop up.
if that doesnt work, maybe you could try setting keyframes manually, like you would in FCP. You dont turn on the red button at all, but add keframes for the parameters you want to animate in the Inspector window.
Sometimes I find I have to add two keyframes a frame apart to give that definite stop. This also allows me to play with the timing of the pauses. So set a keyframe where the camera starts to move and one where it stops. Then a frame on set another keyframe without changing the values, then go to the next point you want the camera to move and set another keyframe.... and so on.
hth
adam -
Here's the scenario: I have a main flash movie that has some
buttons and a container. When you click a button, a MovieclipLoader
loads an external swf. Both files were originally created with
Flash 7 and previously had very little actionscript. Mainly just
some stops, gotos and code for a preloader. The swf being loaded
previously had some static content and worked fine. Now I want it
to load an xml file and fade in some text, but the actionscript
tweens don't work. If I play the swf by itself, it works fine.
However, when I load it into the main movie the tweens don't work.
Right now, for testing purposes, I have the text load with _alpha =
100 and wait a couple frames before the tween script. When the
tween script starts everything being tweened disappears. I figure
it has something to do with the fact that they were Flash 7, and
maybe something isn't being imported right? But even if I publish
them as Flash 7, the tweens don't work. I've embeded all the fonts
too. Even non-text (images, shapes, etc) won't tween. They just
disappear. I've googled this and searched the forums, but I can't
find anything. So, any suggestions would be greatly appreciated.
Thanks,
-RyanJust as information the Tween class uses the _root timeline
to generate an onEnterFrame event to animate objects. If you
mistakenly used the onEnterFrame on the _root to create another
thing like a loader for example. That might be erasing the
tweenings. Try using the onEnterFrame on an empty movie
clip. -
I'm trying to move from the old CAN driver to the XNET driver. It work well to transmit command frames but so far I'm unable to read a telemetry frame, I attached pictures of the expected result (that I get using the old CAN driver) and of what I get using the XNET driver.
And of course I attached the code I'm trying to get working. One strange thing is that the REQ_ID is not inserted in the transmit frame (as seen using I/O Trace) but even when I'm forcing it using bundle by name to the XNET Write vi I'm not reading the telemetry as expected. I'm using the same code (the transmit part) to send commands and it works.
Any idea of what I can try?
Thanks,
Ben64
Attachments:
expected_tlm_read.png 24 KB
xnet_tlm_read.png 52 KB
CAN Status Telemetry using XNET.png 101 KBDepending on your timing, the remote device may have:
1. Already sent the response before you started your input session.
2. Not responded yet
If the problem is (1), try creating and starting both sessions before you write the data.
If the problem is (2), try using a queued session instead of a single point session and actually wait for the frame to arrive.
I actually recommend implementing both solutions - create the sessions first and create the input as a queued session. Then, do a read with a timeout to actually get the response. -
LoadVars and listener functions
Hi all...I posted yesterday with some trouble getting
loadvariables to work. I have since changes the code to use the
LoadVars class instead but I am still have the same issue as
before. The request for variables from the server does not complete
and the values do not get set before the variables need to be used.
I have a simple flash movie with 1 input text box (name_txt),
1 button (Submit) and 1 dynamic text box (lblOutput).
I have a simple script on the button:
on (release) {
//loadVariables("dev.aspx?foo=" + name_txt.text, "POST");
newVars = new LoadVars();
newVars.load("dev.aspx?foo="+_level0.name_txt.text);
//This line just visually shows me that the script makes it
this far
_level0.lblOutput.text += "This is hard coded
text.<br>";
_level0.lblOutput.text += newVars.retVal;
I have a very simple asp page that returns the value:
'Format the response
Response.ContentType = "application/x-www-form-urlencoded"
'Create a string and
Dim foo As String = "&retVal=" &
Request.QueryString("foo") & " - This is from the ASP
Page.<br>"
Trace.Warn(foo.ToString)
Response.Write(foo.ToString)
Response.End()
When I load the Flash movie and type the word "test" into the
input field and click submit...I can see that Flash sends the
variable to the asp page by checking the asp trace information. The
value comes into asp just fine but, as I understand it, I need some
sort of listener function to force Flash to wait for the
transaction to complete before trying to load the use the variable
values.
Could someone please explain how I can add this listener
functionality to the script above? Many thanks!!You need a stop() on the frame doing the load and onLoad.
Then in the onLoad
you move to the next frame. Other approaches include hiding
the UI and in
the onLoad, revealing the UI such as a MovieClip cover is
made invisible.
Declare the results LoadVars object on the timeline outside
of a function
and it is accessible for the entire movie at all levels.
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"nagromme" <[email protected]> wrote in
message
news:e4fpvm$qmq$[email protected]..
I'm using LoadVars in Frame 1, and I need to use the
resulting variables in
other scripts afterwards. (But all the examples I find online
only use the
variables right in the same script.)
The problem I'm having is, the onLoad function doesn't
actually make it
wait.
It goes ahead to the next frame whether fully loaded or not.
It depends on
the
connection at the moment--if the vars haven't fully loaded,
hilarity ensues.
<b>My script in Frame 1:</b>
_root.myloadvars = new LoadVars();
_root.myloadvars.load("datapairs.txt");
_root.myloadvars.onLoad = function(success) {
if (success) {
//trace("TXT RETRIEVED");
gotoAndPlay(2);
} else {
trace("TXT NOT RETRIEVED");
gotoAndPlay(1);
<b>It's SUPPOSED to hold in Frame 1 until ready to
proceed and make use of
the
variables in Farme 2.
Things I have tried:</b>
* Moving the above to Frame 2, so the "not retrieved" loop
actually has two
frames to cycle (back to 1, then forward to 2 where the
script it).
* Adding an additional gotoAndPlay(1) BELOW the above.
But regardless, it never goes back to Frame 1, it always
goes forward. It
reports success, but half the time the variables (or some of
them) are still
Undefined.
What's the RIGHT way to wait in a frame for LoadVars, and
then let other
scripts use the variables afterwards?
<b>Many thanks for any advice!</b>
(PS, this is Flash MX--I'm waiting for Universal Binary
before I upgrade.) -
Problem with lag in E71 autofocus
The autofocus doesn't seem to be working properly with my E71. I press T and wait for the frame to turn green but after I click the picture there is a lag of about 6-7 seconds and the picture quality is very poor. If I don't use autofocus there is no problem.
Anyone else have the same problem. I have tried a hard reset but it hasn't made a difference. Is this some software issue that will be fixed with firmware or is it a hardware problem? Thanks for any suggestions.Same problem here. I tried also with 3rd party camera softwares and it does not improve. Thus, the problem is at least at FW level. I won't think it's an hardware problem because in the video mode, capture is ok.
also even though you don't autofocus, if you move the camera while shooting, it freezes again and takes a picture few seconds later..If you set flash mode always on, the flash light goes off randomly.
Let's hope in a FW update. -
I'm using LoadVars in Frame 1, and I need to use the
resulting variables in other scripts afterwards. (But all the
examples I find online only use the variables right in the same
script.)
The problem I'm having is, the onLoad function doesn't
actually make it wait. It goes ahead to the next frame whether
fully loaded or not. It depends on the connection at the moment--if
the vars haven't fully loaded, hilarity ensues.
My script in Frame 1:
_root.myloadvars = new LoadVars();
_root.myloadvars.load("datapairs.txt");
_root.myloadvars.onLoad = function(success) {
if (success) {
//trace("TXT RETRIEVED");
gotoAndPlay(2);
} else {
trace("TXT NOT RETRIEVED");
gotoAndPlay(1);
It's SUPPOSED to hold in Frame 1 until ready to proceed and make
use of the variables in Farme 2.
Things I have tried:
* Moving the above to Frame 2, so the "not retrieved" loop
actually has two frames to cycle (back to 1, then forward to 2
where the script it).
* Adding an additional gotoAndPlay(1) BELOW the above.
But regardless, it never goes back to Frame 1, it always goes
forward. It reports success, but half the time the variables (or
some of them) are still Undefined.
What's the RIGHT way to wait in a frame for LoadVars, and
then let other scripts use the variables afterwards?
Many thanks for any advice!
(PS, this is Flash MX--I'm waiting for Universal Binary
before I upgrade.)You need a stop() on the frame doing the load and onLoad.
Then in the onLoad
you move to the next frame. Other approaches include hiding
the UI and in
the onLoad, revealing the UI such as a MovieClip cover is
made invisible.
Declare the results LoadVars object on the timeline outside
of a function
and it is accessible for the entire movie at all levels.
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"nagromme" <[email protected]> wrote in
message
news:e4fpvm$qmq$[email protected]..
I'm using LoadVars in Frame 1, and I need to use the
resulting variables in
other scripts afterwards. (But all the examples I find online
only use the
variables right in the same script.)
The problem I'm having is, the onLoad function doesn't
actually make it
wait.
It goes ahead to the next frame whether fully loaded or not.
It depends on
the
connection at the moment--if the vars haven't fully loaded,
hilarity ensues.
<b>My script in Frame 1:</b>
_root.myloadvars = new LoadVars();
_root.myloadvars.load("datapairs.txt");
_root.myloadvars.onLoad = function(success) {
if (success) {
//trace("TXT RETRIEVED");
gotoAndPlay(2);
} else {
trace("TXT NOT RETRIEVED");
gotoAndPlay(1);
<b>It's SUPPOSED to hold in Frame 1 until ready to
proceed and make use of
the
variables in Farme 2.
Things I have tried:</b>
* Moving the above to Frame 2, so the "not retrieved" loop
actually has two
frames to cycle (back to 1, then forward to 2 where the
script it).
* Adding an additional gotoAndPlay(1) BELOW the above.
But regardless, it never goes back to Frame 1, it always
goes forward. It
reports success, but half the time the variables (or some of
them) are still
Undefined.
What's the RIGHT way to wait in a frame for LoadVars, and
then let other
scripts use the variables afterwards?
<b>Many thanks for any advice!</b>
(PS, this is Flash MX--I'm waiting for Universal Binary
before I upgrade.)
Maybe you are looking for
-
How do I restore my iphone to the last backup listed in itunes?
In my attempts to import my voice memos into the new itunes 11, it asked to restore my iphone. I restored to the defaulted backup. All my voice memos and pictures are now gone. I had been automatically back the phone up to icloud. On itunes when
-
Need to make date validation to remove overlab
I have a problem in date validation I will tell you the scenario I have department table as a master table and under this department there is some teachers. Eeach teacher have Start Hiring Date and End Hiring Date . I want to prevent to insert a new
-
Wrong permissions when it is built.
I maintain Vulturesclaw. http://aur.archlinux.org/packages.php?ID=14157 I was about to update but I've noticed on my old PKGBUILD though everything seems to be building fine, there is just one problem with the permissions on the $USERS/~ file. It res
-
DocumentBuilderFactory question
Hi to all! Is it possible to force DocumentBuilderFactory to use default platform implementation? It's neither possible to change system property in applet nor write a file in lib directory. Thanks
-
I bought music on my iPhone and after sync its on my pc but its grey and I can't play it
now its on the bougt list but its grey with an sync sign