ActionScript 3.0 :: Flash - Picking And Playing Movieclip?
Mar 7, 2011
I have two mc's mc1 and mc2. on mouse click of mc3 i want a math random function and a logic argument of if math random =< 0.5 then play mc1, if mathrandom > 0.5 then play mc2. how would i right the AS3 for this?
View 4 Replies
Similar Posts:
Sep 29, 2008
So I got my stage with a bunch of buttons in the middle of it. when you click one a little window pops up, alls good. Problem is that when my mouse is over that window it is still picking up the buttons underneath of it.
View 1 Replies
Nov 4, 2010
I have a movie that loads content from an XML file. The path to the file is passed in using flashvars. I am using SWFObject to embed the Flash in a web page. I have a routine that checks for an XML attribute from flashvars and if available passes it to a variable; if no XML attribute then it uses a default. Because I'm having trouble with flashvars I'm also displaying the path in a text box. The code looks like this:
[Code]....
View 3 Replies
Sep 26, 2011
I am having an issue with picking up custom data types from a drop down lists. To make this as easy to understand as possible, I'll use a simple example of what I want to be able to doSo say I have a custom data type (Say of type Dog). Dog contains a name, breed and age. I store each instance of a dog in an ArrayCollection:[Bindable]private var dogData : ArrayCollection;This ArrayCollection holds 1..N Dog objects with the respective information. Now having a dropdown like so:<s:DropDownList x="81" y="178" id="dogSelected" prompt="Dog Selected:" dataProvider="{dogData}" labelField="dogNameData" />he dogNameData would hypothetically come from a custom ActionScript class that has the 'name' field of the Dog in that object.
Now I want to select a certain dog from the dropdown. I tried to just do it this way:var theDog : Dog;theDog = dogSelected.selectedItem;However, ActionScript does not seem to like this. Now, I read around and found out that using the label field is the way to be able to select this. I have been unable to select the dog item, so I can then bind it to:
var selectedDogBreed : String;
//var theDog : Dog = the selected object from my drop down
selectedDogBreed = theDog.breed
[code].....
View 2 Replies
Mar 12, 2010
Let's say a user can pick fifty different hat colors and styles to put on an avatar. The avatar can move his head around, so we'd need the same types of movements in the symbol for when that happens. Additionally, it gets which hat should be on the 'avatar' from a database. The problem is that we can't just make 50 different frames with a different hat on each. And each hat symbol will have the same movements, it'll just be different styles, colors and sizes. So how can I make one variable that is the HAT, that way we can just put the appropriate hat symbol into the variable and always be able to call Hat.gotoAndplay('tip_hat') or any other generic functions.... Does that make sense?
View 2 Replies
Apr 17, 2011
I have movieClip (in as3) and I'd like to know is this movieClip playing now
View 2 Replies
Jun 15, 2010
I'm re-designing my website in Flash CS4. There will be 6 buttons when it is finished. I have created 6 movieclips that fades in the text when you click on each button. What I'm trying to do is make the movieclip play backwards when a different button is clicked so the text fades back out before the new text fades in. I think I've nearly got it. I googled the effect and found the below action script. I've put it on the first button to see if it works, but I get the error messages at the bottom.
WelcomeButton.onRelease = function() {
startRewind (29);
};
function rewindMovieClip (targetFrame) {
[code]....
I keep getting these error messages:
Scene=Scene 1, layer=Welcome, frame=142, Line 1 - Statement must appear within on handler
View 12 Replies
Dec 2, 2009
I have a MovieClip that consists of multiple layers, one of those layers is an animated background Shape. let's call this MyMovieClip with the background shape have the instance name "mcBackground";
I'm adding the MovieClip to the stage from ActionScript by:
var myMovieClip = new MyMovieClip();
addChild(myMovieClip);
This works fine and when the movie clip is added to the stage it plays as expected (background is moving).
The problem is when I try to apply a colorTransform to the background shape, it stops from moving. what I'm doing is this inside the MyMovieClip class:
[Code]...
View 2 Replies
Feb 3, 2011
I was wondering if someone can help me. I have some difficulties playing a certain frame in another MovieClip. I have two MovieClips, MovieClip(content) and MovieClip(about_page). The about me button is placed in MovieClip(content) and I used the following code to go and play MovieClip(about_page) that is placed in the timeline:
about_btn.addEventListener( MouseEvent.CLICK, myrl1 );
function myrl1( event:MouseEvent ):void
{
gotoAndPlay("37");
}
But now when MovieClip(about_page) loaded i have a button that must go back and play a certain frame in MovieClip(content) I used the following:
close_btn.addEventListener(MouseEvent.CLICK,close1 );
function close1 (Event:MouseEvent): void
{
gotoAndPlay ("29");
}
[code]....
But for some reason it never goes back to Movieclip(content) and I get the following:
TypeError: Error #1010: A term is undefined and has no properties.
at content_fla::about_page_101/close1b()
View 1 Replies
Nov 7, 2011
Is there an easy way to switch out a movieClip for another dynamically loaded movieClip?
I have and eventListener onCLICK that when selected it starts an FLVPlayback but I would also like to swap out with another movieClip Play Now / Now Playing button.
Just some background. I am looping and loading a play button jpg's into one movie clip and assigning an incremental number as a name to the play button movie clip. On Click that play button plays a movie but now I would also like to switch the play button graphic to a playing now graphic.
//ADD EVENT LISTENER TO ALL MY THUMBS_BUTTON
thumbs_button.addEventListener (MouseEvent.CLICK, playVideoThumb);
for (var i:Number = 0; i < my_total; i++) {
[Code].....
View 1 Replies
Mar 17, 2012
i have a "swf" file which is picking url from xml & displaying the image, when i tested it locally it works fine, which means it picks up URL from XML & displaying corresponding image. After i uploaded it on server, it doesn't show anything.
View 2 Replies
Jan 30, 2012
I have two movieclips on the same frame but on different layers located within the movieclip. The first movieclip plays just fine. However, the second one isn't going ahead even a single frame. The code that I have mentioned below is located withing the second movieclip containing background image. And I think this code is causing the issue because when I remove this it plays perfectly fine. The function of this code is to automatically re-size background image with the browser dimensions. The whole code just worked fine on the main timeline.However, when I shifted it inside a movieclip its causing an issue.
//set stage for FBF
stage.align = "TL";
stage.scaleMode = "noScale";
[code]....
View 1 Replies
Nov 20, 2007
i'm trying to get a movieclip within a movieclip to stop playing when it reaches its last frame. let me describe my problem: it should start playing when the user rolls over the movieclip that is containing it(i'll call this mc1, and the movieclip within it mc2). i've put a stop action in mc2's last frame but it won't stop and plays again and again. one thing i should point out is that there is a variable in mc1 that tells the movie whether it's ok to play the movie in reverse when the user rolls over mc1, if this is false, that means that it plays normally(not in reverse). i'm using "play()" to play mc1 when the user rolls over it and this is where i think the problem is; even though the last frame of mc2 has a stop action, it is somehow told to play again? anyways, this is just a guess, i haven't figured out why or how to fix it. i'm not sure if my explanation was too hard to understand so i'll try to clarify it if anyone wants me to.
View 1 Replies
May 1, 2011
I have purchased a flash cursor (.fla) with nice sparkling effects while a cursor is being moved. I would like to make similar/same sparkles playing around a cursor ALSO while a mouse is not being moved. but only stackoverflow.com has the experience in flash, I do lack of it. i use adobe flash cs5 and tried to find a solution for a hell of hours, but unsucessfully. zipped cursor file .fla can be downloaded here: [URL]
View 1 Replies
Jan 14, 2008
I have a number of menu buttons (home, about, contact, etc). Each button loads a new/different movieclip onto the scene. Each movieclip when loaded plays up to frame 25 and stops. When I click on any of the menu buttons, I want the current/loaded movieclip to continue playing until it reaches the end of the clip before loading the next. I tried this actionscript with no luck!
[Code]...
View 2 Replies
Nov 22, 2011
I have a flash container that calls other swf files and loads them and plays them one after the other.I upload/overwrite those files each month as new promos happen.the file names stay the same as they are defined in the container file.Im trying to find a way to add some kind of variable into the action script so it finds the file and adds the date in as well. This way when the browser looks at the files it will see new dates and then load the new file from the server as opposed to the local cache.Is there an elegant way to do this?Im using CS5, but it looks like the action scrip was written in an older version.[code]
View 3 Replies
Sep 27, 2010
with attaching a sound to a movie using AS, in this case, it is a car tire that screeches when rolled over. I added a "tailpipe" idle sound when we roll over the tailpipe of the car. I have attached linking to the sound file named, "idle", and copied the "screech" AS code and edited, but now all the screeching tires have picked up the idle sound. All the movie mechanics work fine. Here's the AS Code:(T1 & T2 are the tires, tailpipe is the idle movie)
T1.stop();
T1.onRollOver = over;
T1.onRollOut = out;
[code]....
View 1 Replies
Nov 13, 2010
We're working to build the front-end of our application and struggling with selecting a good UI framework since we're not experienced UI people (we're mainly back-end developers). The central issue is that we don't know what we don't know and don't know how to best weigh our different options.At the moment, we're evaluating Flex, ExtJS, and Vaadin. Is there another option we should consider? What, are the major elements we should evalutate on?
View 8 Replies
Jul 23, 2008
I have one folder which contain few images. I want to pick RANDOM images from it through my code. How do i go in this.
View 1 Replies
Oct 6, 2010
I have a script that when the use types in their name, it is to pick a random name from the list. Problem is, it isn't picking random exactly I get a lot of repeats and sometimes it just comes up undefined.Here is the script does any one have any ideas of what is wrong?
if (combobox.getSelectedIndex() == 0)
{
txt2.text = "Female Name";[code].....
View 2 Replies
Apr 5, 2011
I am using actionscript 3 and I am creating an array of 16 buttons and need to use the function math.random to get it to pick 5 random unique numbers out of the array. As at the moment it is sometimes picking 5 unique numbers and sometimes it has duplicate buttons appearing?
View 1 Replies
Jul 30, 2010
I have a working AS3 project and it compiles fine to a SWF. I added a new file (via various means: import, drag-drop, new), but it doesn't compile this new file. I'm using Flex Builder 3. I've tried a clean an rebuild. I've tried renaming. It picks up the existing files fine, but not the new one. The project is set to use a HTML wrapper. I see some build files (I think). The new file is in an existing folder and package.
View 1 Replies
Sep 27, 2009
Needed to place objects on the stage in random order, but only place each object twice. [code]...
View 0 Replies
May 23, 2005
I have a normaly created dynamic textfield to which i put something like "_root.MC_container.anyVar" on the variable field.
This textfield is part of a button, so, what i need to do is to redraw the button when the contents of the textfield changes. I have the whole redraw function working ok. But what i cant seem to achieve is to detect the change on the variable i've assigned to the textfield. The content changes, but no redraw function gets called.
I've tried with TextField.onChanged and adding a listener object to the textfield, but none of them seemed to work.
View 1 Replies
Dec 12, 2009
I am running flash through an xml page. The page is a xml generated photo gallery per-say, and I can make it work for the 1st page, but not the sub menus.
XML PAGE
Code:
<title_submenu><![CDATA[APPETIZERS]]></title_submenu>
<content_submenu>dyn_xml_gallery.swf</content_submenu>
In the dyn_xml_gallery .fla file, I have it picking it up from
ActionScript Code:
xmlCategory.load ("dyn_xml_gallery_xml/categories.xml");
The main page picks this up just fine, and shows the pictures as I have listed. But on the submenus, I have the same thing but just different names. So instead of being dyn_xml_gallery.swf, it's now dyn_xml_gallery2.swf.
And in the actionscript, it's picking it up from dyn_xml_gallery_xml2.
With everything renamed and linked to the right object.. any ideas as to why my submenus are still picking up the original file, and not (in this case) my dyn_xml_gallery_xml2.
View 2 Replies
Mar 15, 2011
I have 16 instances of the same movie clip. The movie clip is made up of 16 frames, each with the picture of a face on it. I want it to work such that when I click my button, each face only appears once, so that all 16 different faces are on the screen. I have been trying to use an array containing the numbers 1-16, and removing them as they are randomly selected. However, with the splice function, I can't pick and choose which number is removed.
How to I pick a random number from an array of 16 numbers, and then remove that specific number from the array so it can't be selected again?
View 1 Replies
Nov 17, 2003
i'm trying to display text from a textfile in a dynamic textfield, i have a text file called "quotes.txt" wich has variables set like this:q0=text&q1=text2&q3=text3 etc.so how can i pick these q's at random and place it in my textbox?i've tried this:
loadText = new loadVars();
loadText.load("quotes.txt");
quotes="q"+Math.round(random(10))
[code]....
View 14 Replies
Mar 12, 2006
I am really new with flash and yet I needed to construct a simple one level game. What I have now is kinda similar to pacman but a bit different.
1) Lets say, like pacman, the user's character need to pick up things in the maze. but instead of the items are already there, i would like to have some already there and then when the user pass the path, some will randomly appear in the maze. e.g : like the fruits that will randomly appear in pacman.
2) How to make the bad character constantly chase the user's character throughout the game. only one bad character in this game chasing.
View 2 Replies
Aug 7, 2009
I am loading an external SWF file into my main timeline. The external SWF file contains an FLV video. At a certain point in my main timeline, the SWF file loads and plays the video. Is there a way to say...
If the VIDEO (FLV) is done playing, gotoAndPlay(X)?
View 4 Replies
Sep 15, 2009
I have two buttons named buttonOne and buttonTwo. When I click buttonOne, the movie clip named oneMc should play its intro and then stop then after that whenever I click buttonTwo, the movieclip oneMc should play outro animation and then movieclip twoMc intro comes in.
Do I need to use the Loader and URLRequest for this one? or use a String?Also, how can I call the movieclip to play its outro and play the next movieclip's intro?Here is my code so far...
buttonOne.buttonMode = true;
buttonTwo.buttonMode = true;
buttonOne.addEventListener(MouseEvent.CLICK, btnOneHandler);
[code]....
View 1 Replies