ActionScript 3.0 :: Calling Dynamic MovieClip?
Jun 4, 2009
I'm sure this is a quick and easy question but I've been at it for a while and can't seem to get what the problem is.Inside my movieclip called "movies", I created a dynamic movieclip
Code:
var my_movie:MovieClip = new MovieClip;
addChild(my_movie)
[code].....
View 2 Replies
Similar Posts:
Jan 14, 2012
For some reason, the same code works now, without any problem at all. I don't know what happened, or why, but I no longer have this problem Here's the original post: To put simply, I created a MovieClip, put it with addChild() to stage, and when I tried to call this piece of code:
[Code]...
View 2 Replies
Mar 21, 2007
I'm trying to do somthing like this:
class Timer extends MovieClip
{
// constructor
[code].....
View 3 Replies
Feb 4, 2010
I have to call a movieclip inside of another movieclip.
Let say a movieclip with an instance name location_mc is inside a movieclip with and instance name menu_mc.
How the scripting will be if I want to call the location movieclip.
Everything was working well until I put all my buttons inside the menu moveiclip because I need to do something else.
This is my code which I know is wrong but if just to give you an idea of what I have got:
ActionScript Code:
fitzrovia_mc.buttonMode = true;
location_mc.buttonMode = true;
apartments_mc.buttonMode = true;
[Code].....
View 2 Replies
Sep 10, 2010
I have a dynamic text and i am calling it through XML, i can see the text appearing but there is an extra line space appearing in my swf. I have tried hard to fix it but it's not going.
View 9 Replies
Sep 14, 2011
i have the following script, i'm just doing tests over failed attempts, I have a "cnc+i" dynamic variable, wich is a BitmapData type, i'm sure it's declared since the trace function returns true at the output, what i have a problem with, is at the moment of attaching the Bitmap, i don't know how to call it, and i don't want to do it manually like this: cnc1. Since i am planing on putting the attachBitmap inside a for loop:
ActionScript Code:
import flash.display.BitmapData;
this.createEmptyMovieClip("CNC",this.getNextHighestDepth());
CNC._x=50;
[Code].....
View 1 Replies
Aug 15, 2006
I can't seem to target the mc's that I have pre-loaded externally. The problem is that mcs like 'screen_roadmap' play at the beginning of the compiled movie, and not when I make them visible by pressing on the button. I currently have a stop(); command on frame one, so I would like the movieclip to gotoAndPlay(2); only when I press the button. I have tried things like : this["screen_roadmap"].gotoAndPlay(2);. I used this code from an actionscript book, but it makes no mention of targeting the mcs.
ActionScript Code:
menu.roadmap.btn.onRelease = function() {
gotoScreen("roadmap");
[code]....
View 1 Replies
Nov 18, 2009
Code:
var whatSpecialTrain;
var specialTrain:int;
var a:Array = [1,2,3]
[Code]....
how i can do what i'm doing here without doing it the long way? The only other way i know how to do this is do if statements and duplicate heaps of code, one for each corresponding value...
View 3 Replies
Oct 28, 2010
I have a sprite menu which populates a dynamic textfield with textlabels as users click individual items in the menu in addition to ordinary actions(gotoAndStop). As these labels appear in the textfield, I want to be able to link them to the frames assosciated with the menu - item frames. As you can understand from this, I am working with the timeline. By enabling html rendering of text in the textfield, I have been able to link these output labels via a a href - tag, but I am not able to call a function from this html. The function I am trying to call uses a switch statement to take the appropriate actions according to which label is being clicked, but the only effect I get is the html opening a browser window...... Unfortunately I do not know how to explain this any better, but here is my code for the following:
[Code]....
View 2 Replies
Oct 29, 2010
Tried several approaches for making this happen, but can't seem to do it. I could really use an example of how to do this in my particular case, since I'm not exactly a code - guru..... I have a sprite menu which populates a dynamic textfield with textlabels as users click individual items in the menu in addition to ordinary actions(gotoAndStop). As these labels appear in the textfield, I want to be able to link them to the frames assosciated with the menu - item frames. As you can understand from this, I am working with the timeline.
By enabling html rendering of text in the textfield, I have been able to link these output labels via a a href - tag, but I am not able to call a function from this html. The function I am trying to call uses a switch statement to take the appropriate actions according to which label is being clicked, but the only effect I get is the html opening a browser window...... Unfortunately I do not know how to explain this any better, but here is my code for the following:
Main Timeline, frame 1, actions layer:
ActionScript Code:
import flash.display.*;
import flash.events.*;
import flash.display.Stage;
var buttonTrace:TextField;
var sectionNames:Array = new Array("Frontpage","Introduction",
[Code] .....
View 0 Replies
Mar 7, 2010
i'm attempting to instantiate a bunch of sounds by creating a string array containing each sound's filepath (or name).
var soundByName:Object = {};
var channelByName:Object = {};
var soundName:String;
[code]....
View 1 Replies
Sep 21, 2009
I have a flash movie within it quite a few scenes. When I go to a certain scene it has a movie clip on it (UGFT_MC). Within this I have a dynamic text box (UGFTtxt). I have the render text as HTML selected and the variable called "data". On my main timeline at the start of this scene I have the actionscript: loadVariables("UGFT.txt","_root.UGFT_MC");
Within my text file I have the following:
data=<B>All the code I want in my text box</B>
<p><img src="test.jpg"</p> etc.
This part all works, except I have lots of text and images in the text file and need a scroll bar on my dynamic text box. I have tried the UIScrollBar and it only works some of the time, and there is no pattern as to whether the scroll bar will appear. Quite often it is just a grey area. Though the top of the text called from the file is visible.
View 0 Replies
Jun 6, 2009
I am trying to make a multiplayer card game which has 6 players. Each player can hold 2 cards.
The movie clip names are :
p1c1 // Player 1 card 1
p1c2 // Player 1 card 2
[code].....
View 2 Replies
May 14, 2009
I've been reading over numerous tutorials and guides as well as the Language Reference for ActionScript 3.0 but cannot quite seem to find anything to learn what I need (which I guess is because everything I have read assumes you would already know how to do this sort of thing).On my stage I have one button (mybtn) and one MovieClip. Within the MovieClip I have numerous other MovieClips (the different parts of a character, leg, arm, head, etc).
One of those MovieClips, lets call it "upper_left_arm" (within the other MovieClip "character") is comprised of two Keyframes, frame 1 and frame 2. There is also a second layer with AS in it, which just has "stop()" in it so it doesn't endlessly play.When I click the button on my stage I want to change the playhead to frame 2 and then stop within the "upper_left_arm" MovieClip.I gather that I almost certainly need to use gotoAndStop.However, most information I have found concerning buttons, AS3 and the gotoAndStop command relate to "scenes" which as far as I can tell are nothing to do with what I want.
Code:
stop();mybtn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
upper_left_arm.gotoAndStop(2);
}
The "(2)" is the part I think I have horribly wrong, I've tried various other things after "upper_left_arm.gotoAndStop" with no success. In fact, the MovieClip "upper_left_arm" now loops round merrily despite the "stop()" in the AS in that MovieClip itself .
View 2 Replies
Oct 30, 2009
In a flash movie, I'd like a user to be able to have a choice of buttons, each of which would add a movie clip. (E.g. If they click button "A" it will add a barking dog, if they click button "B" it will add a running cat, etc.)
I then want the user to be able to e-mail this movie with a PHP form (which I know how to do) but in the URL string, it will load the movie (dog/cat) that the user has selected. That way, when their friend receives the e-mail, it will take them to a page with the flash movie that shows the movieclip their friend chose.
View 3 Replies
Jun 17, 2009
This code is inside a movie clip on the main stage. Also on the stage i have a dynamic textbox "tabText". How can i call tabText from inside my movieClip?
ActionScript Code:
homeTab.addEventListener(MouseEvent.MOUSE_DOWN, gotoHome);
function gotoHome(event:MouseEvent):void{
[code]....
View 4 Replies
Jul 6, 2005
I have a function on the first frame of a movieclip with a parameter, The following is the code I have on my movieclip:
Code:
onClipEvent (enterFrame) {
tellTarget("loader"){
picture(9);
}
}
View 2 Replies
Apr 27, 2010
I've got a movieclip on the root of the stage called "bgImg", in that clip I've made this function:
Actionscript Code:[code]..........When you click a button in the nav it loads a movieclip to the stage from the library, inside this movieclip I have a row of buttons,when you click one of these I want to call the function in the movieclip on the root (ie. the function inside "bgImg" .
View 3 Replies
Sep 16, 2007
I have a function I made in the root timeline. Inside of a movie clip, I have a button which calls the function in the actions layer in the root timelime.. how do I make this work?
[Code]...
View 5 Replies
Dec 14, 2009
Hypothetically, I have a movieclip menu that's created using a class menu.as at runtime. When I instantiate that class on the stage of the main swf, how would I go about telling that stage what to do on a specific click? For instance, if I click button1 on the menu, how do I tell the stage to turn random_object's alpha down to 0?
Important note - buttons in the menu class are loaded dynamically, and there is no way (that I know of) of binding them specifically to event listeners on the main swf stage as in "menu.button1.addEventListener(...)". To summarize my question - how do I control the main stage from within a movieclip, without assigning eventListeners on that main stage?
I have managed to make it work using this method: Inside the class, I add an event listener to each button. On CLICK, the button calls e.currentTarget.root.desiredFunction() where desiredFunction is the function on the main swf stage I want to run. Is there a more efficient or clean way of doing this that anyone knows of?
View 6 Replies
Jan 26, 2010
If I have a MovieClip, simply a blue square with class AS file called blueBox, in the constructor of the blueBox.as file I have:
this.addEventListener(MouseEvent.MOUSE_DOWN, sayHello);
Why does this not call the sayHello method when I click the movieclip on the stage? I know on the stage that I could grab the instance of my bluesquare movieclip and add an event listener to it that way, but I just wanted to 'encapsulate' in a bit more.
View 5 Replies
May 25, 2010
ActionScript Code:
onClipEvent(enterFrame){
this.slot1incr();
[code]....
View 0 Replies
Oct 18, 2011
I'm having a problem where I have a button on the main timeline that when clicked needs to gotoAndStop first on frame 3, where there is a movieclip, that i want it to gotoAndStop on frame 30 (of that movieclip). Any ideas?
I can't have it just gotoAndStop on frame 3 and then have the code to gotoAndStop on frame 30 either because I need to be able to have the moviecliped called like this a number of different times.
View 2 Replies
Dec 14, 2011
I am creating movieclips into which I want to load thumbnails which are to be loaded dynamically. I'm not sure if the solution I am trying to build is the more effective way to do this; I'm still quite a noobie.
Each movieclip container which I will use hold the thumbnails is of a size to hold 16 thumbs, so the number of holder movieclips required is calculated at the time the xml loads; with the movieclips then being created, named and stored in an array. (The idea is to then move between these movieclips (and so the thumbs) using previous and next buttons) - however, I'm not at that stage yet!
However, when I call each movieclip to place the loaded thumbs in, the code throws the "#1010: A term is undefined and has no properties" Error. I think this is a problem with the array; and possibly the mc not being defined properly. However, I am not sure where my problem is.
[Code]...
View 7 Replies
Sep 11, 2010
Here is the simple example
//main is MovieClip on main timeline
//VideoPanel is MovieClip in the library
var theVideo:VideoPanel=new VideoPanel();
main.addChild(theVideo);
[Code].....
View 3 Replies
Apr 10, 2010
I have 2 nested move clips in this order.
mc_a (grand parent)
mc_b (parent)
[Code]....
Now, I have a button on the stage. I am trying to load mc_a on stage using the linkage, and trying to load an image that replaces c_inst.
I am using:
on(release)
{
_root.attachMovie("a_call", "a_called", 1)
_root.loadMovie("image1.jpg", _root.a_called.b_inst.c_inst)
}
But so far it only attaches the movie, doesn't load the image.
View 1 Replies
Dec 1, 2010
So I'm having trouble calling my movieclips that I created and assigned strings to their names.So I'm trying to create 3 movieclips with 3 different instances and add them to the stage.here's the code:
for(var i:int = 3; i > 0; i--){
var myMC:MovieClip = new MovieClip();
var myMCName:String = "MCName"+String(i);
[code].....
View 3 Replies
Feb 25, 2010
I have a variable, we'll call it helloNurse, defined in the document class, we'll call it Joy, as a public variable. Meanwhile, I have a movieclip within the FLA that uses that class as its document class that, simply put, needs to access that variable. I had read up that the following SHOULD work:
[Code]...
View 12 Replies
Feb 17, 2009
I'm learning AS3. I would like to call an Array which contains five mc. Although when I check for errors on the script it says that it doesn't have errors, when I test the movie I have a
couple of errors.
1046 Type was not found or wan not a compile...
1180 Call to a possibly undefined method
placeRandomPicture();
Here is my script.
var listLoader:Array = new Array(back_1, back_2, back_3,back_4, back_5);
bt_1.addEventListener(MouseEvent.CLICK,
function (evt:MouseEvent): void {
function placeRamdomPicture (): void {
var iRandomImage = Math.round (Math.random() *
listLoader.length-1);
iRandomImage = (iRandomImage > -1) ? iRandomImage : 0;
picHolder.addChild(new listLoader [iRandomImage]);
} placeRandomPicture();
});
View 15 Replies
Nov 14, 2011
I am trying to trace a variable string from inside a movieclip which is inside another movieclip on the main timeline using:
[Code]...
View 6 Replies