Pausing And Continuing Set Interval
Hi,I am using set interval.I can clear the interval to stop it, but when I use the play(); command it continues from the beginning and I want it to continue from where I left off.the timeline is 10 frame long. I want to continue from a specific frame. I already tried gotoAndPlay (frame#) and it doesn't work. Maybe I had it in the wrong place. I bolded the area that needs some sort of code, somewhere within/below it.Any ideas?Here is the code.frame #1//SET INTERVALstop();callback1 = function (){if(_currentframe == 10){gotoAndPlay(1);clearInterval(ID);}else{nextFrame();}};var ID:Number = setInterval( callback1, 1000 ); // NAVIGATION BUTTONS// GRAMP STAMPgramp_stamp_mc.onRollOver = function(){clearInterval(ID);gramp_stamp_still_mc2._visible = true;this.onEnterFrame = function(){if(this._alpha >= 60){this._alpha = this._alpha - 4;}else{delete this.onEnterFrame;}}}gramp_stamp_mc.onRollOut = function (){gramp_stamp_still_mc2._visible = false;_currentframe = 2;play();this.onEnterFrame = function(){if(this._alpha < 100){this._alpha = this._alpha + 4;}else{delete this.onEnterFrame;}}}frames #2-#10 are similar to the below:gift_card_mc2.onEnterFrame = function(){if(this._alpha > 0){this._alpha = this._alpha - 5;}else{delete this.onEnterFrame;}}
ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-02-2009, 07:50 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Pausing And Continuing During A Movie.
I'm looking for answers here. Heelp me.
1. How do I pause a movie while it is playing (perhaps during a slideshow) then be able to continue the movie again.
I can make a button that stops a movie. But how do I make this same button play the movie again? Do I have no other choice than to have 2 seperate buttons. I.e. one for pausing and the other for continuing? Is there a simpler Action Script?
2. And one more thing. After publishing my movie and opening the HTML file, the movie plays in the browser window, I want it to have a quit button which closes the browser window. How do I do this as well?
Pausing A Frame, Then Continuing...
Flash5
this is probably easy peasy, but nevertheless.
Instead of adding frames to a scene to lengten a keyframe, can't you use an actionscript on a keyframe to 'pause' the flashanimation and then after some seconds (which you define) continue with the animation? And if yes, what is that actionscript?
Thanks!
Pausing An Interval And Retrieving Later
hey guys, i have a set interval woking fine, however when they press thebutton i use clear interval. when they then press the other button to start the interval again it wont do anythng??? any ideas??
Pausing Timeline Problem -cant Stop The Interval?
Hello,
Im really out of any ideas, so here comes my problem, any idea for solving is welcome.
I have a little slideshow within a movieclip on my stage, using code to pause timeline for few seconds(also in the same mc like slideshow):
function paused(sec) {
stop();// action to pause
var i = sec-1;
var t = setInterval(function () {
if (i == 0) {
clearInterval(t);
play();
// action to continue
}
i--;
}, 1000);
}
calling it on every needed frame of mc by "paused (number of seconds i want)"
It goes well, unless i click on any of buttons on the main stage, switching to the next frame of the main timeline. After clicking on it, it goes on the next frame(frame02 for example) of main timeline, but than it seems(for me), that function paused is still continues and after running out of "(number of seconds i want)" it jumps on the next frame(frame 03) of main timeline and stops there.
I tried different methods to pause the timeline but its the same or even worse (it doesnt stop on "next next frame" at all and looping)
I thought about specifying more this
if (i == 0) {
clearInterval(t);
because it says that the interval is cleared only when "i" reaches "0" so when i click the button before it reaches it, it has to go to the and and than play. But have no idea how to clear it when i click anything, cause in the "next frame"s actions clearInterval(t); doesnt work:-(
searched through many forums and many walkthoughs but didnt find the same or similar problem:-( Does anyone has any idea how to make it work fine?
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
Set Interval / Clear Interval Question
Ok, here is my problem. I have a bit of actionscript the makes a sentence of text slide out. I just want this text to hang around for about 3 seconds and then slide back out. A delay within the AS to pause the AS before it continues through. I posted this question in here before and I got back some responses on set interval and clear interval. Now I did find a great link to this which I'm sure will help a lot of people out
http://www.umbc.edu/interactive/flas...?p=setInterval
but I just didn't understand how I could use that with what I'm trying to accomplish. Here is the start of my code.
onClipEvent (load) {
myX = 650;
myY= 480;
div = 6;
}
onClipEvent (enterFrame) {
_x += (myX-_x)/div;
_y += (myY-_y)/div;
}
onClipEvent (enterFrame) {
if (this._alpha <100) {
this._alpha += 5;
}
}
I also have the text fade in.
I'm just not sure how to put a delay on this AS before it runs to the end.
Just plain confused.
Any help would be great.
Continuing?
i have a movie, and at a certain point i had to use a symbol, movie clip that is. i added a "stop();" action on the same frame that the MC is on, i want the MC to play, then when it's finished, i want to resume to the next frame. how would i do this????
Continuing Health Bar
I have a health bar created but I dont know how alllow it to continue to the next scene, so, my health bar disappears in the next scene, and how would i get it to continue when it has low health into the next scene. Thank you for your help in advance.
Continuing With Scores
Hi there,
I'm using flash mx and created a multi level shooting game. I understand the scripts to generate points per kill with the "bad guys", but how do I set it so the point total continues with each new level instead of reseting back to 0? Thanks.
Continuing An Mc Before Unload
I have a button that gets a mc, the mc goes 6 frames and then stops, after the six frames there are another 6 wich is basically the mc in reverse.
What I want to do is upon a rollout of the button that calls the mc, I want the mc to play its last 6 frames( the reverse effect) and then unload.
I have been trying to figure this out for about 3 hours and cant get it.
Stopping A Swf From Continuing...
I have three layers in my fla... the order goes:
alpha tween for x frames, another alpha tween for x frames, then i have an image loader component on the last frame, that won't start, because the first two continue to loop... any help is much appreciated.
Continuing Once An Flv Has Played Through
Ok... I'm a designer, not a developer and google isn't helping me out much.
I have an flv playing in the FLVPlayback component on a single frame. I've got a stop on that frame but I need my flash movie to continue once the flv has completed.
I did embed a cuepoint at the very end when I encoded it in case I'd need it.
I'm not seeing an easy solution. Adobe's help is far too cryptic for me... I need someone to write out the syntax for me...
Thanks in advance.
Continuing To Next Step
hi ...kirupaville..
I have a question. I have an html splash that has a button for my flash intro. Once the button is pressed, a pop-up window shows up where the animation plays. Now right after the animation is played, I want this pop-up window to disappear and I want my splash page to automatically change into my inside html home page. I see this done with a lot of flash sites+html sites. Help is needed.
peace
Continuing To Next Step
hi ...kirupaville..
I have a question. I have an html splash that has a button for my flash intro. Once the button is pressed, a pop-up window shows up where the animation plays. Now right after the animation is played, I want this pop-up window to disappear and I want my splash page to automatically change into my inside html home page. I see this done with a lot of flash sites+html sites. Help is needed.
peace
Change The Interval Of An Interval?
Hey,
I was wondering if there is a way to change the interval of an interval? With this I mean, the amount of MS's it waits before the function is called.
I would also like to know if there is a noticable difference on different computers when using intervals <60?
Thnx,
SaphuA
Check To See If Swf Is Loaded Before Continuing
I am loading a swf to level 20
then after that I load another swf into level 0 (that replaces original swf)
then the swf on level 0 access the information that resides on level 20.
swf on level 20 is 618kb and the one on level 0 is only 153kb...
so how do I code so that the first swf that calls up the two new swf's (level 0 and level 20) will not call up the level 0 new swf until the level 20 has loaded?
the level 20 one is a music clip...needed for the level 0 clip and ensuing swf's that will loaded into level 2, the code is already written so the the new level 2 swf will be able to turn on and off the level 20 music.
Waiting For A Function To End Before Continuing.
Hi guys,
I have a function called loadboard(textfile) which loads data from an external textfile. I wish to run this several times eg:
loadboard("text1.txt");
loadboard("text2.txt");
loadboard("text3.txt");
However, I wish to wait for each occurence of the function to finish before attempting the next loadboard().
The only way I could see to do it at the moment was to add a button and click it when I saw each function had finished but this is far from ideal.
Any ideas please?
Continuing Movie While Scene Changes
I'm still pretty new to flash.. So this might be a newbie question.
Is there any way for you to have a movie clip continue when you change scenes rather than starting over again every time a new scene begins playing? Same goes for Sounds. Can you have a sound continue to play when scenes are changed?
If anyone can help me out, I'd really appreciate it!
David
The Continuing Story Of Flash To ASP
Regular readers will be aware of the struggle I've had getting a contact form working at falcon. I've finally got it working but when the form is sent a blank browser window pops up with the address of the asp code. Shotsy247 recommended targetting the asp form in a frame in a frameset with
Code:
on (release) {
getURL("mail.asp","returnPage","POST");
gotoAndStop(2);
}
but this still didn't work. A curious thing I've spotted: the flash swf is in the mainFrame. The bottom frame (returnPage) I've given a blue background to so I know it's there. When I hit the send button the flash file goes to it's second frame. When I test it in a browser the bottom, returnPage, of the frameset disappears, yet it's still working from one flash file. I'm so near with this and would appreciate any ideas as to where I've gone wrong
Continuing Lines Along Path?
Okay, I've got a parabola where the user can adjust the x-intercepts and vertex. That works no problem, I'm just positioning 3 points and using moveTo and curveTo. However, I need to extend the lines off the parabola past the x-intercepts and I can't figure it out.
I tried to plot another point on either end of the parabola, but my math must be off, and it looks like I'm sticking two lines on the end of the parabola. I think I'll have to get another mid-point and use a curve to in order to get the consistent curved look, but, without the math to calculate the points, it won't matter how many points I add.
Here's the code and the file is attached:
Code:
//set initial slider values
sliderPara_p0.slide._x = 20;
sliderPara_p1.slide._x = -5;
sliderPara_p2.slide._x = 5;
para_mc.onEnterFrame = function() {
//calculate vertex y
this.p0._y = this._parent.sliderPara_p0.slide._x*5;
//calculate x-intersects
this.p1._x = this._parent.sliderPara_p1.slide._x*5;
this.p2._x = this._parent.sliderPara_p2.slide._x*5;
//figure x of vertex based on center of p1 and p2
if ((this.p1._x)<(this.p2._x)) {
this.p0._x = (this.p2._x/2)-(this.p1._x/-2);
} else {
this.p0._x = (this.p1._x/2)-(this.p2._x/-2);
}
//display values in slider text fields
this._parent.display_a = Math.round(((this.p0._y*2)/100)*10)/10;
this._parent.display_p = Math.round(((this.p1._x*2)/100)*10)/10;
this._parent.display_q = Math.round(((this.p2._x*2)/100)*10)/10;
//calculate lines
tmpA = (this.p1._x-this.p0._x)*2;
this.p10._x = tmpA+this.p1._x;
this.p10._y = (this._parent.display_a*-1)*((tmpA/2-this._parent.display_p)*(tmpA/2-this._parent.display_q));
tmpA = (this.p2._x-this.p0._x)*2;
this.p20._x = tmpA+this.p2._x;
this.p20._y = (this._parent.display_a*-1)*((tmpA/2-this._parent.display_p)*(tmpA/2-this._parent.display_q));
this.clear();
//draw parabola
this.lineStyle(1, 0, 100);
this.moveTo(this.p1._x+this._x, this.p1._y+this._y);
this.curveTo(this.p0._x+this._x, (this.p0._y*2)+this._y, this.p2._x+this._x, this.p2._y+this._y);
//draw lines
this.moveTo(this.p10._x+this._x, this.p10._y+this._y);
this.lineTo(this.p1._x+this._x, this.p1._y+this._y);
this.moveTo(this.p20._x+this._x, this.p20._y+this._y);
this.lineTo(this.p2._x+this._x, this.p2._y+this._y);
//text for equation
if (this._parent.display_p>0) {
temp_p = "- "+this._parent.display_p;
} else if (this._parent.display_p<0) {
temp_p = "+ "+(this._parent.display_p*-1);
} else if (this._parent.display_p == 0) {
temp_p = "- 0";
}
if (this._parent.display_q>0) {
temp_q = "- "+this._parent.display_q;
} else if (this._parent.display_q<0) {
temp_q = "+ "+(this._parent.display_q*-1);
} else if (this._parent.display_q == 0) {
temp_q = "- 0";
}
this._parent.display_function = "y= "+this._parent.display_a+"(x "+temp_p+")(x "+temp_q+")";
};
Anyone out there that can help??
FLV Continuing To Play, Even When Not On The Timeline?
I have an FLV that is in a movieclip on frame 1 only. When I jump to frame 5 (where the movieclip that is holding the FLV is no longer there) the audio of the FLV is still playing in the background. If I jump back to frame 3 (where the FLV is STILL not there), THE AUDIO OF THE FLV PLAYS AGAIN!
What gives?!?
Continuing In Timeline After FLV Plays
I want to play an .flv in the timeline, then continue to play the timeline after the video has finished. How is this done? I've tried to understand cue points (I get the basic idea), but how do I utilize them in ActionScript?
Preloading MP3, Then Continuing Onto Movie
My Preloader works fine, loads the mp3 not a problem displays the percentage without a problem...so what is my problem you ask? Its the fact that as soon as the mp3 is loaded to 100% and is meant to play the rest of my animation with mp3 playing in the background, it for whatever reason plays my movie up to the 20th frame, and goes back to the 1st frame and continously loops... I have no actionscript to tell it to do this..and frankly I have been working at fixing this for the last 3 days and feel I have exhausted every avenue.
I originally have all of the script attached to an empty Movieclip myMusicMC, but for some reason the preloader would not work, so I seperated the code I originally had, some on the empty movie clip, the rest on to the main stage, and it worked, but now there is this new problem.
Here is my code on the empty MC.
Code:
onClipEvent(load) {
//Set the Preloader Bar to 0.
_root.loadBar._xscale=0;
}
//
onClipEvent(enterFrame) {
_root.mySoundBytesTotal = _root.myMusic.getBytesTotal();
_root.mySoundBytesLoaded= _root.myMusic.getBytesLoaded();
_root.mySoundLoading=Math.round((_root.mySoundBytesLoaded/_root.mySoundBytesTotal)*100);
// Update text box with percent loaded
if (_root.mySoundLoading!=null) {
_root.percentLoadedText=_root.mySoundLoading+"%";
}
// Scales load bar
_root.loadBar._xscale=_root.mySoundLoading;
}
Here is the code on the main stage.
Code:
stop();
_root.myMusic = new Sound();
_root.myMusic.loadSound("music.mp3", false);
//define a function to preload the sound
function checkLoad() {
var percentLoaded = (_root.myMusic.getBytesLoaded()/_root.myMusic.getBytesTotal())*100;
progress = Math.round(percentLoaded);
if (percentLoaded == 100) {
_root.gotoAndPlay(3);
}
}
//create a setInterval to call the preload function until the sound has loaded
checkProgress = setInterval(checkLoad, 1000);
The idea was to have the mp3 completely loaded into cache, and then starting right away when the animation would begin, with fade in etc. I have seen this done so I know there is a way, and it feels like I am so close I just need your guidance to fix it.
Thanks for your help.
Waiting For A MC To Stop Before Continuing?
Hello all,
I am hoping someone has done this before - basically I have an animation stored in a movieclip. I have 5 instances off this mc stored off the stage. Whenever the user enters a wrong response, one of the mc's play a walk animation and a person 'walks' onto the screen. After moving 80 pixels, an if function in the onEnterFrame deletes the onEnterFrame.
However, if the user enters more then 5 wrong answers, the persons start a new animation. The problem is that if the user gets a question wrong before the person has finished moving - the person stops and does the new animation.
Thus I was hoping to use setInterval after a check to see if anything is moving. Yet it doesn't see to work. My traces show no delay between the interval trace and the trace after the interval.
Here is a section of my code; basically when k = 6, the fifth person has been called previously and the moving variable is a boolean set to true. But when run, there is no 20 second delay, it just says 'slow' then 'delay' and then kicks into the final animation.
Code:
if (k > 5){
trace(person5.moving);
if (person5.moving){
trace("slow");
slow1 = setInterval(blank(),20000);
}
End();
}
function blank(){
trace("delay");}
In the end, I was hoping to have the script wait until the end of the last persons animation (when it stops walking) and then play the new animation. Any suggestions?
Thank you,
Cedwyn
Loops And Continuing When Condition Is Met.
Hello all.
I have this function that has a loop in it.
Code:
function createCollection(array) {
trace("hello from function createCollection");
createEmptyMovieClip("col_mc", 2);
col_mc._x = 150;
col_mc._y = 0;
//
var spacing:Number = 15;
for (var i = 0; i<array.length; ++i) {
var y:Number = (i*spacing);
var name:String = "item"+i+"_mc";
col_mc.attachMovie("list_mc", name, i);
col_mc[name]._y = y;
col_mc[name].name_txt.text = array[i]["collection_id"]+" "+array[i]["collection_name"];
}
}
How do i get it to hold until col_mc[name] has reached frame 80 in its timeline?
So it loops then waits for the movie to get to frame 80 before carrying on.
Any ideas
I've tried putting in a while loop but thats not working.
Continuing Flash Movie
Ok, I'm not a flash guy, but I have been asked to research whether the following is possible.
We have a flash animation that runs on the pages of our websites that displays a list of financial contributers to the site. The problem is that the list runs from the beginning every time, which causes a problem when someone refreshes, or goes to another page on the website, because the animation starts from the beginning again. Is there any way (in flash or whatever) to allow the animation to continue on the website where it left off on the previous page?
FYI, for your reference one of the sites is http://www.rockfallsrockets.com/index.asp
TIA
Phil
Continuing Flash Mx 2004
Hi
I have some basic knowledge in flash mx 2004.
About everything i know ive learned from the lynda.com flash mx 2004 cd rom.
Now im looking for a book that can take me one step further in my learning.
Iv checked some books out there but it seemes that almost all of them is around the same level as that cdrom so it seems like it would just be a waste of time buying any of them because i already know the thing that is in them.
So i need some kinf of intermediate level of book.
Im am interesting to learn both flash better and also actionscripting.
I can ad that i just have very little knowledge in actionscripting.
Just very. very, very basic knowledge.
Moving A Dot, Rotating It And Continuing It Down That Path
How can I have a movie clip move a direction (_x+=5) and then after a while have it turn a random direction and continue down that way until the same amount of time in which it turns again. I want to do this in actionscript so that it's completely random the directions that it goes. Here's what I've tried which doesn't work:
on the stage is an instance of movieclipDot which contains
onClipEvent(enterFrame){
if(_root.trigger==1){
this._rotation=random(360)
_root.trigger=0
}
}
in that movieclip is and instance of movieclipDotMain which contains
onClipEvent(enterFrame){
if(_x <> _root.x){
dirtyBit=0
_x+=5;
}else{
if(dirtyBit<>1){
_root.trigger=1
_root.x=_x+50
dirtyBit=1
}
}
}
and the actionscript in that frame is
_root.x = jo._x + 50;
stop()
Continuing From Previous Scene Or Preloading?
My site is up at http://www.geocities.com/hel_leviathan. Its 157k and i've been told is a little slow loading on 56k...
I was planning on seperating the spinny logo bit from the fading in content bit so it loads as 2 scenes instead of one. Will I need to make my first scene a preloader, or can I just split them and have it load and play scene one while scene two is still loading to reduce the delay of my site appearing?
Will it work OK either way? Will one give better results than the other? Is much coding involved?
Thx for your time
Lev
Continuing Animations During A Pause In A Presentation?
Ok, I'm stuck...
I'd like to use Flash instead of PowerPoint to do professional presentations, but there is one thing I can't figure out.
I need to pause between "slides".... and that's no problem. But as in almost any PowerPoint presentation, I would like to have animations loop during those pauses. How can I set this up so that an animation or scene will loop until I use a button press to continue?
Are there some good resources out there for developing PowerPoint-like presentations in Flash?
- Will
Scrollpane And Motion Tween (continuing Here Please)
i'm sorry, but writing the html code before (the one who was not
appearing), i now having the window closing when i click any button
sorry!
well, after reading your question, i made some changes and:
scroll content: deg
instance name: prueba
on the first frame: prueba.FBoundingBox._visible = false;
(i put it like an action, in expert mode and this code on the first
line)
and it's still not working...
Slide Show Continuing In Ease
Hi all,
i want to know how to put a motion slide show and pics goes from right to left without jogging, a smooth motion i mean.
can any body help?
you'll find a sample that i did and the fla file also but with the sily jogging action.
i think there was a way, i don't remember exactly, it has something to do with _x *= 0.8
check this link:
http://e3lanat.com/fla/
Thanks
Displaying Thumbnails Continuing Saga
You may remember last episode when this n00b starting bothering people to help him with making a thumbnail page of external images.
=)
I was able to get them to display fine, and using just image placeholders, I can get them to _visibility = false when you click the image and move to another frame.
But I'm needing to be able to display images w/o changing the code as a user uploads new images to the server.
With incredible help from catbert303 and Master64 (there's a number theme going on here) I've gotten some code that allows me to display any number of external images creating rows and columns...but I can't get them to "disappear" one one is clicked.
Master64 has helped me try, a lot, but while I don't see any reason why it shouldn't work, when I use the changes he suggests, the images just don't display.
I MUST have a typo in here I'm not catching. I accidently changed something or miscopied something, and I'm not seeing it.
Maybe a fresh pair of eyes might catch why the images aren't displaying?
code:
depth = 0;
myVars = new LoadVars();
myVars.onLoad = function(success) { // the variables are loaded
if (success) {
var i = 0;
var x = 1;
var y = 1;
var cols = 4; // the number of columns to make
var rows = 5; // the number of rows to make LINE ADDED!!!!
var xSpacing = 120; // how far to space out the columns
var ySpacing = 90; // how far to space out the rows
while (this["image" + i] != undefined) { // pick out the images returned from the textfile, these will be in variables name image0, image1 etc
var xPos = x * xSpacing; // find the x position for the next clip
var yPos = y * ySpacing; // and the y position
newPic(xPos, yPos, this["image" + i]); // call the function
if (x == cols) { // the end of the row has been reached
y++; // move down to the next row
x = 1; // reset the column count
} else {
x++; // otherwise move onto the next column
}
////////////////////////
// THIS PART JUST ADDED
if (y == rows) { // the end of the rows have been reached
//x++; // move down to the next column
_root.gotoAndStop("crdRev");
y = 1; // reset the row count
//} else {
// y++; // otherwise move onto the next row
}
// PREVIOUS PART JUST ADDED
///////////////////////////
i++;
}
}
};
//
myVars.load("thumbtest.txt");
_root.createEmptyMovieClip("allPics" + depth, depth); //add this-------------------
depth++;//add this------------------------
function newPic(x, y, image) {
_root.allPics.createEmptyMovieClip("imageHolder" + depth, depth);//change this ---add allPics-----------------------------
_root.allPics["imageHolder" + depth].createEmptyMovieClip("holder", 1);
_root.allPics["imageHolder" + depth]._x = x;
_root.allPics["imageHolder" + depth]._y = y;
_root.allPics["imageHolder" + depth]._xscale = _root.allPics["imageHolder" + depth]._yscale = 50;
_root.allPics["imageHolder" + depth].id = depth;
_root.allPics["imageHolder" + depth].onPress = function() {
_root.allPics._visible = false;//add this -----------------------
}
_root.allPics["imageHolder" + depth].holder.loadMovie(image);
++depth;
}
The file "thumbtest.txt" contains the line:
&image0=images/creation/animals/Aquatic004.jpg&image1=images/creation/animals/bird014.jpg&image2=images/creation/animals/Bird069.jpg&image3=images/creation/animals/Bird105.jpg&
If I remove the word .allPics from all of the above lines, the images display fine, but I can't find any way to make visibility = 0 or false.
Thanks for any help!! =)
Liam
Displaying Thumbnails Continuing Saga
You may remember last episode when this n00b starting bothering people to help him with making a thumbnail page of external images.
=)
I was able to get them to display fine, and using just image placeholders, I can get them to _visibility = false when you click the image and move to another frame.
But I'm needing to be able to display images w/o changing the code as a user uploads new images to the server.
With incredible help from catbert303 and Master64 (there's a number theme going on here) I've gotten some code that allows me to display any number of external images creating rows and columns...but I can't get them to "disappear" one one is clicked.
Master64 has helped me try, a lot, but while I don't see any reason why it shouldn't work, when I use the changes he suggests, the images just don't display.
I MUST have a typo in here I'm not catching. I accidently changed something or miscopied something, and I'm not seeing it.
Maybe a fresh pair of eyes might catch why the images aren't displaying?
code:
depth = 0;
myVars = new LoadVars();
myVars.onLoad = function(success) { // the variables are loaded
if (success) {
var i = 0;
var x = 1;
var y = 1;
var cols = 4; // the number of columns to make
var rows = 5; // the number of rows to make LINE ADDED!!!!
var xSpacing = 120; // how far to space out the columns
var ySpacing = 90; // how far to space out the rows
while (this["image" + i] != undefined) { // pick out the images returned from the textfile, these will be in variables name image0, image1 etc
var xPos = x * xSpacing; // find the x position for the next clip
var yPos = y * ySpacing; // and the y position
newPic(xPos, yPos, this["image" + i]); // call the function
if (x == cols) { // the end of the row has been reached
y++; // move down to the next row
x = 1; // reset the column count
} else {
x++; // otherwise move onto the next column
}
////////////////////////
// THIS PART JUST ADDED
if (y == rows) { // the end of the rows have been reached
//x++; // move down to the next column
_root.gotoAndStop("crdRev");
y = 1; // reset the row count
//} else {
// y++; // otherwise move onto the next row
}
// PREVIOUS PART JUST ADDED
///////////////////////////
i++;
}
}
};
//
myVars.load("thumbtest.txt");
_root.createEmptyMovieClip("allPics" + depth, depth); //add this-------------------
depth++;//add this------------------------
function newPic(x, y, image) {
_root.allPics.createEmptyMovieClip("imageHolder" + depth, depth);//change this ---add allPics-----------------------------
_root.allPics["imageHolder" + depth].createEmptyMovieClip("holder", 1);
_root.allPics["imageHolder" + depth]._x = x;
_root.allPics["imageHolder" + depth]._y = y;
_root.allPics["imageHolder" + depth]._xscale = _root.allPics["imageHolder" + depth]._yscale = 50;
_root.allPics["imageHolder" + depth].id = depth;
_root.allPics["imageHolder" + depth].onPress = function() {
_root.allPics._visible = false;//add this -----------------------
}
_root.allPics["imageHolder" + depth].holder.loadMovie(image);
++depth;
}
The file "thumbtest.txt" contains the line:
&image0=images/creation/animals/Aquatic004.jpg&image1=images/creation/animals/bird014.jpg&image2=images/creation/animals/Bird069.jpg&image3=images/creation/animals/Bird105.jpg&
If I remove the word .allPics from all of the above lines, the images display fine, but I can't find any way to make visibility = 0 or false.
Thanks for any help!! =)
Liam
Code To Play A Mc Before Continuing The Timeline
Hey,
I need the code that will make a whole mc play before playing the rest of the timeline.
I had it somewhere but forgot it now...
I made most of my movie out of movie clips, and rather than spacing them out the right amount of frames so they all join together right, like I did at first, i'd rather do it the easy way.
Ian
Stopping... Then Continuing Sound Problem
I'm not sure if anyone's come across this question but knowing Flashkit..probably
I have a movie that has links to other urls. When I click a url it then opens a new window. My problem is that I have music on my webpage and some of the other urls that I open have music as well. Obviously I don't want two different music tracks playing at the same time.
I know that I can stop my music from playing when I open a new window but I'd really like it to continue (or start again) when I close the new window. Is this possible or what is the common solutiion for this?
Thanks for any opinions
Continuing A Single Wav Through Multiple Scenes
Okay, so I'm making a movie with multiple scenes, and I'd like the .wav file I have at the beginning to play all the way through. On the first frame of scene 1 is a button with the action script to play on release attatched to it. I don't want the music to start until the button is pressed, and I've tried everything I can think of, but when it gets to the second scene the music cuts off abruptly. If you can help, I'll love you forever.
Loading A SWF On Upper Level Before Continuing
Ok. Here's the link and it may display correctly on faster machines. I doubt I did it correctly since I know very little about AS. I'll break down the structure and if you could be so kind to give me suggestions.
1. In my main movie (0.swf) I am using Slideshowpro. This requires the move to be published using AS2 and flash player 7
2. In my secondary move (1.swf) I am using prototypes that require the movie to be published using AS1 and flash 6
3. So what I was trying to do is bring in my 0.swf movie and put all the content on frame 150. The movie 1.swf has an animation that takes that length of time.
4. Problem is 0.swf will obviously load first and zoom down the time line. By the time 1.swf is loaded 0.swf is already at the frame and you can not see my animation.
Is there a simple way around this or am I looking for disaster?
I appreciate any help. Thanks a milllion
Rogerhttp://www.rogercline.com/fake/0.swf
Continuing An Action With Differing Destinations
Hi - I am trying to figure out how to have the same action (by which I mean the same set of frames) play with different final destinations, according to a user decision.
For example, a picture fades in and three buttons appear, taking the user to x, y or z. I want the image to fade out the minute any button is pressed, then taking the user to the correct destination (x, y or z). I know how to fade the image in (just using a simple alpha tween, not any advanced actionscript), but I don't know how to 'un-fade' with multiple destinations.
Cheers! L
Continuing On Seperate Movie Clip....
Alright I'm reposting this cause I read the thingy about helps and things. Alright, yesterday I posted: I needed help with:
I have a scene that has a button, when it's clicked, it goes to the next scene, in this scene there's 2 movie clips, one starts to play apon entering the scene, then when that one finishes, the next one p[lays........claudio helped me with this and gavbe the basic code for it, then I went in and changed a couple of things in the movie clip to get it to work and it worked (thanks claudio). Well anywho, now I have another problem, the coding he gave me worked for 2 movie clips but I dunno how to make a 3rd movie clip play after the second one.......someone please help me, thanks ~ Jay~
here's the coding claudio gave me:
this.onEnterFrame = function() {
with (panel1) {
if (_currentframe == _totalframes) {
this.panel2.gotoAndStop(2);
}
}
};
and here's what I have so far so you guys get more of an idea of what I'm trying to achieve:
http://www.geocities.com/miscar_redrum/mri.swf
Loadmovie Continuing Problem - Script Included
Here is the script on the main movie button for about us:
on (release) {
loadMovieNum ("About us.swf", 1);
}
It loads fine
So, on level 0 is my main movie, and on level 1 is the about us movie.
Now, when i try to load portfolio.swf (for example), once i click on the portfolio button, about us.swf will dissapear for one frmae, showing level 0 (the main movioe) for one frame, and then loads the portfolio movie! I don't want it to flash the BG, i want it to just load the new movie!!!Should i load the movies on different layers or something, I AM STUCK!!!
[MX] Preloading Images Or Waiting Until Loaded Before Continuing.
I have 2 questions and was wondering if any of you helpful bods would be able to answer them.
1) Is there a way to pre-load images for use in an MC?
I have project that takes user input, uses this to fill an array with http address of a bunch of images. It then cycles through the images, loading them into my MC which I've set to fade in, wait a few seconds then fade out. The images are just flashing up, which I think is due to the MC fading in but not waiting for the image to be loaded into the MC first.
2) Is there benefit or requirement to unload an image from an MC?
This is after the MC has been faded out, the Actionscript loads the the next image from the array into the MC before going back and fading back in again. I'm not sure if this is relevant, just thought I saw somewhere, an unloadMovie command.
How Do I Pause Actionscript For A Few Seconds Before Continuing Transitions?
How do I pause actionscript for a few seconds before continuing transitions?
Have searched, but can't find the answer. I have a bunch of mc's using the Transition Manager, and want to have it wait 3 seconds between 2 animations.
Quote:
foo = TransitionManager.start(qtq, {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:2});
foo.onMotionFinished = function() {
foo = TransitionManager.start(qbq, {type:Wipe, direction:Transition.IN, duration:2, easing:None.easeNone, startPoint:8});};
You guys rock - you helped me out big time yesterday and i really appreciate it. Some day (yes, some day in the not-so-distant future), i'll hopefully be able to answer questions as well. Until then, thanks a lot guys!
Waiting For An Object To Finish Before Continuing For Statement
So what im trying to do is create an engine that runs through an xml file and grabs the data, puts it into an array, passes the array into a function and so on and so fourth.
Everythings going fine until i hit a roadblock.
Code:
var playGame = function():Void {
log("---- Start Game ----");
for(l=0;l<structure.length;l++) {
var blockArray = structure[l].split("|");
log("blockArray = " + blockArray);
switch(blockArray[0]) {
case "movie":
log("This is a Movie");
playMovie(blockArray[1],blockArray[2],blockArray[3]);
break;
case "map":
log("This is a Map");
playMap(blockArray[1],blockArray[2],blockArray[3]);
break;
case "menu":
log("This is a menu");
playMenu(blockArray[1],blockArray[2],blockArray[3]);
break;
default:
break;
}
}
}
var playMovie = function(id,src,name):Void {
// Cinema Playback
log("Src = " + src);
var cLoader:MovieClipLoader = new MovieClipLoader();
this.createEmptyMovieClip("cContainer", this.getDepth(consoleBG)-1);
cLoader.loadClip(src, cContainer);
//_global.inProgress=true;
_global.inProgress = true;
while(inProgress == true) {
// this infinite loop crashes the game
}
}
var finished = function() {
_global.inProgress = false;
}
theres the code that matters most
Essentially what im trying to accomplish, is its loading an external SWF movie and i want it to wait until its done, before executing the next object in the array (which is a level).
In the SWF object, i have
_parent.finished();
being called which is to tell the engine that its done and can continue on with the next object.
im assuming id use a this.onEnterFrame but i havent a clue where, and an infinite while loop just crashes the engine (obviously)
im at my wits end, does anybody have an idea here?
Using NetStream To Stop Video Sound Continuing
Firstly my actionscript knowledge is very basic so please forgive me for knowing very little.
My problem is: I have flv videos on my site, if the user doesn't pause the video or let it finish before clicking to get somewhere else the videos sound will continue to play. There are several buttons the user could click to get to different pages. I understand I have to use NetStream.close() but have no idea beyond that. Will I have to add it to every button the user could then click? How would I put it in the code for each button?
Code at the moment:
Code:
//kitchen
mc_altogether.kitchen_btn.addEventListener(MouseEvent.CLICK,kitchen);
function kitchen(e:Event):void {
mc_altogether.gotoAndStop("illustration3");
}
|