Go To Random Frame Labels - Help
What I want to do is tell a specific MC to go to a random label each time the MC enters a frame. I have a stop on frame two, then a button that tells the movie to go back to frame 1 (to reset the random function).
(it's a scratch off ticket that gets reset)
I can't find any good documentation of random AND labels. Thoughts for me?
FlashKit > Flash Help > Flash ActionScript
Posted on: 12-12-2002, 01:26 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Jump To Random Frame Labels
Hi,
I am trying to build a small quiz and I have a next button which when the user clicks should jump to and stop on a random frame label within the movie. Does anyone know how I can do this? I have tried the following code on the first frame of my movie but it doesn'y seem to work!
function shuffle(arr:Array):Void {
var len:Number = arr.length - 1;
for (var i:Number = len; i >= 0; i--) {
var p:Number = Math.floor(Math.random() * (i + 1));
var t:Object = arr[i];
arr[i] = arr[p];
arr[p] = t;
}
}
var labels:Array = ["1", "2", "3"];
shuffle(labels);
var currentLabel:Number = 0;
function gotoNextLabel():Void {
if (currentLabel < labels.length) {
gotoAndPlay(labels[currentLabel]);
currentLabel++;
} else {
stop();
}
}
gotoNextLabel();
Can anyone help me please?
Random Jump To Frame Labels With No Repeats
Hi,
I have a flash banner in which I have 5 frame labels - lets say "a" "b" "c" "d" and "e".
I have been looking at this very helpful blog in which to randomly jump between these frame labels. Th blog is here:
http://www.quip.net/blog/2007/flash/...ithout-repeats
However, although this works really well, once all the labels in the array have been playing the animation stops, but I need it to shuffle the array again and then start playing them again in the new random order. I have been searching but can't seem to figure out how to do this as I am not a programmer.
can anyone help?
the script I am using is:
Code:
function shuffle(arr:Array):Void {
var len:Number = arr.length - 1;
for (var i:Number = len; i >= 0; i--) {
var p:Number = Math.floor(Math.random() * (i + 1));
var t:Object = arr[i];
arr[i] = arr[p];
arr[p] = t;
}
}
var labels:Array = ["a", "b", "c", "d", "e"];
shuffle(labels);
var currentLabel:Number = 0;
function gotoNextLabel():Void {
if (currentLabel < labels.length) {
gotoAndPlay(labels[currentLabel]);
currentLabel++;
} else {
stop();
}
}
gotoNextLabel();
Thanks for your time.
Steve
Targetting Frame Numbers Instead Of Frame Labels
Does anyone know if there's a way to target frame numbers in another movie or movie clip?
I want to be able to scroll backwards and forwards in one timeline by dragging a handle in another movie clip.
I know you can target frame labels but I don't want to have to label every frame.
¨
[Edited by caution:flammable on 02-19-2002 at 03:36 PM]
Random Labels
Hi there, this is from a previous AS post from kode: for playing random labels ....
ActionScript Code:
var labels = ["beer1", "beer2", "beer3", "beer4", "beer5"];var frame = labels[Math.floor(Math.random()*labels.length)];_root.amstle.gotoAndplay(frame);
basically its not playing the labels randomly. Not sure why.. looks like it should work....
Is there another way to do it, besides storing the labels in an array.
Any sugg.. much appreciated..
mako
Random Labels
Hi there, this is from a previous AS post from kode: for playing random labels ....
ActionScript Code:
var labels = ["beer1", "beer2", "beer3", "beer4", "beer5"];var frame = labels[Math.floor(Math.random()*labels.length)];_root.amstle.gotoAndplay(frame);
basically its not playing the labels randomly. Not sure why.. looks like it should work....
Is there another way to do it, besides storing the labels in an array.
Any sugg.. much appreciated..
mako
Random Labels: What Am I Doing Wrong?
Hi there
I'm trying to make a game (in Flash 4) where part of the graphics are randomly selected frames of a movie clip. I have the frames labeled sequentially like so:
glass_0, glass_1, ... etc
So that
Begin Tell Target ("/Glasses")
Go to and Stop ("Glass_" & Random(10))
End Tell Target
will go to and show a randomly generated label. All well and good so far. The problem is that I need to know what the random number is for the purposes of the game. But when I try to assign that random number to a variable, and pass that variable on to the go to statement (as shown below), nothing happens.
Set Variable: "index" = Random (10)
Begin Tell Target ("/Glasses")
Go to and Stop ("Glass_" & index)
End Tell Target
Can anybody tell me what mistake I am making here? Thanks.
Playing Random Labels Or MC's
Is it possible to play random frames on the timeline using labels?
Also how to I load a random movie clip at the same time?
I've got 6 character sequences that I need to play randomly. At the same time a random speech bubble appear. Any help is appreciated.
Starting Flash At Random Labels
Hello folks,
I have a very simply flash animation that just fades in/out about a dozen logos, and I want the flash to start at a random label each time it is loaded. What would be the best way to develop that?
Thanks in advance.
Setting Random Sequences Via URL And Labels?
I need to pass a variable from the URL to tell a script what set of labels to include in a random goto label script. I am a complete newb and need a hand.
Here is what I have so far (don't laugh too hard)
I place this at the beginning of the movie and on the last frame of each sequence:
__________________________________
function getRandomLabel():String {
If (framelabel eq "set1")
var labels:Array = new Array("label1","label4","label6");
If (framelabel eq "set2")
var labels:Array = new Array("label2","label3","label5");
If (framelabel eq "set3")
var labels:Array = new Array("label3","label8","label7");
If (framelabel eq "")
gotoAndPlay(5);
var index:Number = Math.floor(Math.random() * labels.length);
return labels[index];
var counter:Number = 1;
}
this.gotoAndPlay(getRandomLabel());
____________________________
The URL variable is framelabel=set1 etc.
Any help would be appreciated!
Creating Random Play With Labels
I have 5 labels inside 1 movieclip that I would like to activate with a play button that randomly choices one of the labels when pressed. Can someone please assist me with this. To be honest I'm not great with action script so a sample code or tutorial would be ideal.Thanks in advance.
Regards
Creating Random Play With Labels
I have 5 labels inside 1 movieclip that I would like to activate with a play button that randomly choices one of the labels when pressed. Can someone please assist me with this. To be honest I'm not great with action script so a sample code or tutorial would be ideal.Thanks in advance.
Regards
Frame Labels And Frame Numbers
Hi -
I am looking for a way to correlate a frame number with a frame label
For example if I wanted an action to occur untilt the movie hit the frame label I would ideally be able to do somethign along the lines of:
do {
play ();
} while (_currentFrame != "label name");
This does not seem to work, but I am hoping that this is close to something that will.
Obviously, I can put an action to stop the clip in the labeled frame, but I only want it to stop there under certain conditions . . .
Frame Labels
Flash 5 Question: In a short .swf, I am placing frame labels on 1 track, however, each time I insert a frame label, it converts the previous frame label to the same label. If I then fix the one that changed, it then remains correct. What am I missing?
Thanks!
Frame Labels
I am using a Mac - can frame label names have spaces or should i use an under _ score?
for example in
on (release) {
_root.gotoAndPlay("label in scene")
is it ok to have the spaces?
Frame Labels
is there a way to address a frame label like you would a frame number? I'm making a radio and its a living nightmare for me to use raw numbers to advance to the next track. right now I've got this for the next track button
if (_currentframe > 1 && _currentframe < 8659) {
gotoAndPlay(8660);
}
and so forth to advance tracks.... each track has its own lable though... like "Song1" and then "Song2" . What I would like to do is say something like:
if (_currentframe > "Song1" && _currentframe < "Song2" - 1) {
gotoAndPlay("Song2");
}
how can I do that? Or if there is a better method can someone please tell me? this has been driving me nuts.
thanks in advance
--Metalguy
Frame Labels
how do i add frame labels in MX....
stoopid ytes but i need to know thnx!!
---- Frame Labels ----
hi hi,
can I use frame labels in actionscript?
Because I did like this ("infostop" is the name of the label):
on (release) {
if (_currentframe=="infostop") {
loader = 1;
gotoAndPlay ("infostop"+1);
}
}
and it doesn't work........
any solution?
Frame Labels.
Hi Peeps,
Trying to work out how to use frame labels in if statements. Is it possible?? I got something like this, but duh it dont work!! :
if (movieclip._currentframe < movieclip._("framelabel")) {
play();
}
Any ideas? I've never used frame labels like this and I got it all wrong. Maybe theres an easier way to do it so any help would be really good. I dont want to use frame numbers as i've got a lot of moving around to be done.
Cheers.
Steven.
Frame Labels?
i really have looked everywhere, and i cannot for the life of me, figure out how to create a frame label!! pleeeease help!!!
-glam st. glam
p.s.
i'm using flash mx 2004
Frame Labels
I am working a project (already developed) which has many frame Labels. all with hard coded links in the buttons (ie gotoAndPlay "LabelName") is there an easy way where I can use something like nextFrameLabel previousFrameLabel to jump along and back through the timeline?
Or does anyone have a better method?
Frame Labels Please Help
Hi there, I can't seem to get anyone to help me! I have my site right? now each page is a Scene. (I know I know, I shouldn't use scenes) Everyone tells me that I should use Frame labels, thats fantastic, but when I try to go make them I don't even know where to start so my site will work. I'm going to throw this computer out the window pretty soon....please help...Ive been trying to make these links work for three days now.
[MX] Frame Labels
I am trying to follow this tutorial:
http://www.flashkit.com/tutorials/In...-532/more3.php
Which will create scrollbars on my flash website.
My problem is that when it asks me to put in a frame-label of 'load' it seems to label frames 1 and 2, not just 2. Am I missing something or does this always happen? My concern is that I asks me to make more frame labels soon after 'load'.
Also, when I add ActionScript, why is it when I click Frame 2, the ActionScript from Frame 1 is there? Should there not be a blank field for Frame 2?
Thanks.
Frame Labels
hi, is there any way to tell what frame label a movie clip is currently on, or can you only use the numeric _currentframe?
Frame Labels Help
In a previous post I asked how to "unload" a particular scene when another scene was called into play. It seemed a bit unpractical, so instead I have tried using frame labels. Sounds easy enough right?
ARRRGH!
So I've assigned the Instance Name that the clip itself is under "Pictures", and have labeled the frame "hb" So the actions that I have applied to the button as seen above, should play the clip, but it doesn't. The interesting thing is, it will play text if I place some on the "description" layer, just not the 'graphical clip itself. What's going on??
Frame Labels
Can you not have a frame label using numbers?
I have a button going to a frame label and when I use words, it works but when I change it to numbers (which is want to use (years)) then it doesn't.
It doesn't make sense as to why it won't take numbers.
[CS4] Frame Labels
Am amending a flash file that worked perfectly in CS3.
On amending and testing in CS4 all of the frame labels in particular scenes cannot be found. They are all on the timeline but when testing the swf I get:
ArgumentError: Error #2109: Frame label testLabel not found in scene testScene.
at flash.display::MovieClip/gotoAndPlay()
at test_fla::MainTimeline/test_click()
If i replace with frame number it works. If I change back to frame label I get same error.
Anyone else had this problem and fixed it?
Frame Labels
I need a code in action script 3.0 that allow you to go to next frame label and the previous without arrays naming each of the labels. These actions will be controlled using and a previous/next button. I need the most simplistic way of doing this..
Where Are The Frame Labels In CS4?
CS4 is pretty great so far except the panels are a bit buggy. Does anyone know where the frame labels are located now? Can't find them anywhere. I opened an old file that has them and I can get to them in CS4.
Using Frame Labels
I want to use buttons to move the play head from one frame label to the next on the main timeline.
I get the following error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Intro_fla::MainTimeline/Intro_fla::frame6()
What am I leaving out. It was so simple in AS2.
there are three buttons with instnce names: InArticleBnt, InVideoBnt, backBnt
there are three frame labels: intro, video, article
// The buttons listeners
InArticleBnt.addEventListener(MouseEvent.CLICK, article);
InVideoBnt.addEventListener(MouseEvent.CLICK, video);
backBnt.addEventListener(MouseEvent.CLICK, intro);
//the button with the labels I want them to go to.
function article(event:MouseEvent):void {
this.gotoAndPlay("article");
}
function video(event:MouseEvent):void {
this.gotoAndPlay("video");
}
function intro(event:MouseEvent):void {
this.gotoAndPlay("intro");
}
Frame Labels
Firstly I have a main swf file called index.swf which calls in other swf files:
_root.body.loadMovie("fscommand/home.swf");
I am trying to code the main file to call in the new movie at a particular frame label.
Is this possible.
Cheers
Frame Labels In MCs
hi, is there a way to use _Up, _Over, and _Down as a frame label in an MC to act as the button states?
Frame Labels
ok so just a simple question. im creating a siple site in flash and have all my navigation and buttons on Frame 2. can anyone tell me how i can put buttons into different frame labels? heres my problem
like i said i have all my buttons on frame 2. im creating a real estate site and i have to have a couple links like HOME ABOUT BUYING SELLING CONTACT, the thing though is that in the BUYING and SELLING frames i want to add more sections and links but only on these 2 other parts of my site. when i code it though my movie plays over and ver and over non stop. heres my coding...
frame 1
my preloader
frame2
home_btn.addEventListener(MouseEvent.CLICK, onHome)
function onHome(event.MouseEvent):void
{
gotoAndStop("home");
}
about_btn.addEventListener(MouseEvent.CLICK, onAbout)
function onAbout(event.MouseEvent):void
{
gotoAndStop("about");
}
etc....
etc...
and i put my link im trying to get to in a different frame here but the movie plays over and over again
Frame Labels
Firstly I have a main swf file called index.swf which calls in other swf files:
_root.body.loadMovie("fscommand/home.swf");
I am trying to code the main file to call in the new movie at a particular frame label.
Is this possible.
Cheers
Frame Labels?
I am trying to make a menu but I can not get some of my buttons to work. For example: The frame label where I want one of my buttons to go is "Contact Us" This is the action I put on the button:
on (release) {
gotoAndPlay("Contact Us");
}
The frame label is on the main stage
I have my button within a movieclip and the movie clip with another movie clip.
Does anybody know why it doesn't work?
Thanks
Frame Labels
This question is soo simple and I did this before but dont remember...
But how do you put a frame LABEL on a frame??
(embarrassed to ask this)
Frame Labels...
Last edited by erdubya : 2003-10-09 at 16:52.
How do I reference a frame label inside a symbol (not the instance of a symbol)?
Confusion:
I can reference the frame NUMBER inside the symbol but when I put a label on it, it doesn't work.
I have a symbol called oval.
frame 1 (label: odd) has a funny shape.
frame 25 (label: oval) has an oval.
frame 45 (label: peanut) has a peanut shape.
I have a shape tween b/w each keyframe.
I drag an instance of oval onto the stage and attach this action to the instance:
-----------------------------------------
onClipEvent (load) {
gotoAndPlay("oval", 25);
}
this works perfectly...but when I change the frame number (25) to the frame label (oval) it doesn't work...
------------------------------------------
onClipEvent (load) {
gotoAndPlay("oval", "oval");
}
How can I reference the frame by the frame label?????
Thanks a bunch!
Going Back Frame Labels.There Is A Better Way?
Hello
I would like to know if there is any simple way to make this. I have made
several presentations where you have the posiblity to go back and forward
with the keyboard (i.e. you press the key left and you go previous label).
I've made this manually every time, changing the actions in each button.
There is a better way to do this?. In director, for instance, you have the
behaviour of "go to marker" and everything is solved.
Thanks in advance.
Problems With Frame Labels
I'm using a script like this -- _parent.gotoAndStop("14"); -- in a multi-scene presentation. I'm just trying to go down to a main timeline and over to a frame label. Only thing is, that command sends it to the 14th frame, back in a previous scene.
Can anyone tell me why Flash doesn't recognize ("14") as a frame label?
THANKS!!!!
Ben
Variable Frame Labels
I need to know if you can put variable in a frame label so you that if you change a variable in the first frame of a scene that the frame labels will refelect that.
Also can you do this for scene names???
Frame Labels Into Variables
Using the following code I am attempting to assign myMovie's current frame label to myVariable.
myVariable = _root.myMovie._currentframe;
Navigation W/Frame Labels
Please bear with the complexity of this (maybe it's not quite as complex as I think)
Summary: multiple framed environment (Java/Flash/HTML), user clicks button, title of page scrolls in at top (top frame), the document is displayed in the bottom frame. I have a help button that gives tutorials based on the button clicked. What I want to do is, once the user clicks on a button, e.g., dogs, Dog Title above scrolls out (and stays), the .html file loads below, but if the user wanted to know how to take care of the dog, they would click the help button (in the top frame;same as all other buttons(main Nav)) and the help button would replace the current html with the applicable help tutorial html. I tried targeting the frame labels (which are located on the main timeline..the problem is, I realized this won't work because the frame labels only indicate the start of the scrolling title text -- it stops 19 frames later (total 20 frames) Now that I have confused all of you and myself, here is my shot at the scripting, which doesn't even come close.
HELP please!!!! =) thanks!!
script on help button: In summary, on release, if current frame label is "x", getURL "blah blah blah blah", "main"
Do I have to add the extra frames to the current label? I'm lost, and feel like a LOSER!!!
HELP again!!!
Frame Labels To Numbers? :-)
does anyone know of a way (or if it is possible) to translate a frame label into a frame number?
I need to do this in a scene I am working on where I forward on by doing gotoAndPlay("some frame label") ... but when I return I need "some frame label" + 1 really...
any ideas?
_root Frame Labels
Am trying to command the _root layer to go to a specific frame lable using a varible to define where it should go but unfortunatly its not talking properly i also have a a lot of if statments as there are 16 possibilities from the menu.
when a button is pressed on the menu it sets a root variable (nextplace) to the frame lable name ie "profile"
_root.nextplace=profile
then on the root a mc plays to its end and goes through the if statments
with (_root)
if _root.nextplace==profile
gotoandplay "profile"
}
}
until it reaches profile then it needs to go to the frame lable in the root "profile"
any suggestions
Advancing To Frame Labels
Ok all you flash Gurus out there. I need help with ActionScript in MX. Now I am a flash "Designer" not a "scripter" so please bare with me.
I basically have a slide presentation. It is a self running presentation with graphics and sound. It needs to have previous and next buttons on it. The problem is how do you get the buttons to go to the next (or previous) frame label. I tried making an array but it goes to the first slide in my array. How do you capture the current position of the timeline and make it jump to the next (or previous) frame label.
Now i know the hard way of doing it. Make a button for each slide. But I have over 70 slides. There has to be a better way in actionScript.
Frame Labels In Symbols
i created a movie clip symbol, and gave the first frame a label.
Now how do i play this from my scene1 level?
I created a button which should start the movie clip, but in the actionscript normal mode the frame label from the movie clip doesn't appear.
What Happend To Frame Labels- In MX?
Hello :
I think I probably have an easy one here for you. I used flash 4 quite a bit-- and liked using frame labels in controlling my movies. I now have MX and I can't figure out how to put a label on a frame. Did they change the name of the "labels?"
Thanks for the help!!
Frame Labels Or Numbers?
I have a mc that executes:
code:
_root.content.gotoAndPlay(_global.newContent);
where for example _global.newContent = "010"
this is meant to send the playback head to the frame labeled "010"
for some reason actionscript doesn't view the 010 as a label but rather as a number.
Can I get around this in some way so that the above action actually sends the playback head to the label?
Thanks,
K
Specifying Frame Labels When Using LoadMovie
Hi People!
Does anybody have any idea of how to target specific labelled frames when using loadMovie.
So for example (in pseudo code):
Load 001.swf into my current movie using my mc "moviePlacement" as a target and then inside 001.swf go to the frame labelled Page04.
Is this possible?
If so, can someone tell me how, you'll be a lifesaver!!!
Cheers
Deadhands
|