ActionScript 3.0 :: Targeting Dynamically Created Movie Clip?
Oct 6, 2009
i'm creating a menu where i place movieclips dynamiclly:
for each (var button:XML in XMLgothrough) {
//Create a new menu item
var menuItem:MenuItem=new MenuItem ;[code]....
but i keep getting a ReferenceError: Error #1065: Variable menuItem1 is not defined.at MethodInfo-359()error.
View 14 Replies
Similar Posts:
Jan 27, 2005
I am having trouble targeting a movie clip that was dynamically generated from information in an XML document. Basically, what I want to do is be able to manipulate the movie clip after it was generated by the initial function. Unfortunately, I can't figure out how to properly target the clip even though I am pretty sure I have the proper title and location (tried both _root. and _level0.).[URL]the string at the bottom - "_level0.mc_image2" - is the name of the last movie clip (with an image inside) to the right.
View 1 Replies
Jan 27, 2005
I am having trouble targeting a movie clip that was dynamically generated from information in an XML document. Basically, what I want to do is be able to manipulate the movie clip after it was generated by the initial function. Unfortunately, I can't figure out how to properly target the clip even though I am pretty sure I have the proper title and location (tried both _root. and _level0.).
I've put the files I am working with online for reference:[URL]
If you load the swf [URL] ) the string at the bottom - "_level0.mc_image2" - is the name of the last movie clip (with an image inside) to the right.
Also, if you look at the code, you'll see this is a modification of the portfolio from: [URL]
View 1 Replies
Jan 1, 2004
I have a looped sound and some components in my main movie (scroll bar) which for some reason is really bogging down my swf and causing the preloader bar not to show up until like 46% or something ridiculous.
So I am trying to solve the problem by having a preloader swf as suggested by Kode in this thread. However, now all my targeting is messed up in my main movie. Everything that was _root has to change but I can't tell what to load it into. I tried using _parent, _parent._parent, _root.container_mc (which is a blank movie clip created in the preloader swf that main is loaded into after the preloader is 100%) and others but nothing works. Even the simple looped sound which was originally just _root.backsound.start(0,999) can't be targeted. how to target things on my main stage based on the preloader swf?
View 14 Replies
Feb 17, 2010
I'm dynamically creating movieclips with dynamically created movieclips inside them and am having trouble with targeting them.Below is a simplified example of what I'm trying to achieve, in the real file there are a lot more movieclips and I'm creating and naming them with a for loop.
This one is just one Sprite created inside another sprite. I can target the top level sprite named "testname". However when i try target the nested MC it throws an error.The bottom couple of traces are just test MCs I've made to make sure i got the syntax right, on targeting nested movieclips.
PHP Code:
var holder:Sprite = new test1();holder.name = "testname";this.addChild(holder);var holder2:Sprite = new test2();holder2.name = "testname2";holder.addChild(holder2);trace(getChildByName("testname").x); //this one traces finetrace(getChildByName("testname").getChildByName("testname2").x);//this throws up an errortrace(testclip1.x);trace(testclip1.testclip2.x);
View 1 Replies
Jan 22, 2009
So I have a movieclip that I am dynamically adding to the stage when a user clicks a particular button. There are multiple button that each result in the movieclip getting attached to the staged and scaled to a different particular size. Instead of attaching a new instance of the movieclip every time a button is clicked, I only want to attach a new movieclip the first time one of the buttons are clicked and then scale the dynamically added movie to the size specified in the functions for all of the subsequent button clicks. To be clear, I want to attach the movieclip on the first click and then scale it for all of the subsequent clicks.
Here is the code I am using for the buttons:
ActionScript Code:
stop();
videosBTN.onRelease= function() {
[Code]....
View 4 Replies
Dec 10, 2009
Is there any way to dynamically name a varaiable or created movie clip? I know that I could make an array of movie clips, but what I really want to do is make a new movie clipe name based on another name. The reason I want to do so is that I want to pass a movie clip to a function and have it make a new movie clip (to contain the first) with a slight variation of the test such as "frame" or "handle" which I can then use to center the source movie clip.
View 1 Replies
Nov 15, 2009
I created a movie clip [code]...
How can I animate this (slide to x position), since there is nothing in timeline ?
View 2 Replies
Feb 10, 2010
I just tried to use a sprite mask another movie clip .But it doesn't workis there any way to try thishere is my code
ActionScript Code:
sp = new Sprite();
addChild(sp);
[code]....
View 2 Replies
Dec 18, 2004
Is it possible to attach some script to a dynamically created movie Clip?
View 7 Replies
Feb 17, 2010
I'm dynamically creating movieclips with dynamically created movieclips inside them and am having trouble with targeting them.
Below is a simplified example of what I'm trying to achieve, in the real file there are a lot more movieclips and I'm creating and naming them with a for loop.
This one is just one Sprite created inside another sprite. I can target the top level sprite named "testname". However when i try target the nested MC it throws an error.
The bottom couple of traces are just test MCs I've made to make sure i got the syntax right, on targeting nested movieclips.
PHP Code:
var holder:Sprite = new test1();
holder.name = "testname";
this.addChild(holder);
[Code]....
View 5 Replies
May 9, 2010
im currently trying to target frame 2 and a movieclip on that frame This works. But now im trying to target a movieclip inside a movie clip.This code works when trying to target one movieclip.cal.onPress = function() {gotoAndPlay(2);message.total = unit1;}how can i edit that code to find another movieclip inside the movieclip message?
View 6 Replies
Feb 26, 2011
I am trying to target a movie clip within a movie clip.
I have a movie clip on the main stage with an instance name of a
I have the following action script on it
on (release) {_root.a.gotoAndStop(2);
}
So on frame 2 of a I have a button (instance name b) which also has two frames and a stop action on frame 1. All I want to do is click on the button and make it go to frame 2. It should work but it isn't Here is the actionscript on the button (b) on (press) {_root.a.b.gotoAndPlay(2); }
View 2 Replies
May 9, 2010
Im able to link to a movieclip inside a movieclipUnfortunately one of the movieclips now are a scrollbar and scroll. Now the actionscript isnt working?cal.onPress = function() {gotoAndPlay(2);message1.contentMain.message.total = unit1;
View 17 Replies
Mar 26, 2006
Q1) The registration point of a created clip is top left - my question is how can I dynamically change it's registration point - say to center center?
(I am trying to attach a movie clip to a created clip and I wanted it to be centered inside the container - a related sub-question, how can I find the x-y coordinates of the attached movie clip within the created movie clip?)
Q2)When I tried to create two different movie clips, I found I had to create them at different depths, else the first would load and the second would not. Why would that be so? I'm on MX 2004 Pro.
View 4 Replies
Jan 10, 2010
here is a snippet of code in first frame of the movie I have trouble with:
----------------
for (var i = 0; i < 5; i++) {
var container:MovieClip = new MovieClip();
this.addChild(container);
[Code]....
I am getting an error message: A term is undefined and has no properties. I checked list of objects and container0.one and it's there but I can not get to container0.one.usecase
View 6 Replies
Oct 7, 2003
I have a movie clip in my main movie. The movie clip has buttons on it that tell where the play head should go in the main movie. I'm using this script;
[AS]
_parent.gotoandStop(28);
[/AS]
The play head goes to the right frame but it keeps playing even though I've specified it to "gotoAndStop" at frame 28. I've tried using labels and addressing it that way but same thing happens.
View 2 Replies
Oct 7, 2003
I have a movie clip in my main movie. The movie clip has buttons on it that tell where the play head should go in the main movie. I'm using this script;
[AS]
_parent.gotoandStop(28);
[/AS]
The play head goes to the right frame but it keeps playing even though I've specified it to "gotoAndStop" at frame 28. I've tried using labels and addressing it that way but same thing happens.
View 2 Replies
Dec 16, 2009
how to target to the another movie clip to animate?I was using code as below but the output is not really correct.It seemed something is duplicating (I just suppected)
PHP Code:
import flash.display.MovieClip;
var mc_Ripple:MovieClip = new Ripple_Text() ;
[code].....
View 7 Replies
Mar 18, 2010
this is weird, ive tried all my resources and cant come up with the solution.
heres the heirarchy
Main Stage
sampleStage_mc (this contains all my samples)
sampleStageNavigation_mc (this is the movieclip that houses my buttons)
............................................
what i want to happen is when you click on one of the button_mc, i want it to target a frame label on the "sampeStage_mc" timeline.
heres my code:
Actionscript Code:
toshibaBtn_mc.addEventListener(MouseEvent.CLICK, toshibaSample);function toshibaSample(evtObj:MouseEvent) { parent.gotoAndPlay("toshiba");}
theres four timelines, here is the outline
button_mc (i click this and it runs the code in sampleStageNavigation timeline)
sampleStageNavigation_mc (timeline that holds the ActionScript and the button_mc)
sampleStage_mc (timeline - this is the one I need to access)
main stage (timeline)
View 10 Replies
Jul 28, 2005
I have three small images on the stage in frame 1. I also have an invisible button symbol over one of the images and have given this button an instance name. On frame 2 there are the same three images but with a lower opacity level and also on this frame 2 is a movie clip instance containing an animation. I need an onRollover event connected to the button on frame 1 so that when the user rolls over it, the playhead jumps to frame two and shows the images and also plays the animation in the movie clip.
I've applied the following code to the button symbol on frame 1:
stop();
specialised_btn.onRollOver = function() {
gotoAndPlay(2);
}
and I've also put a stop action on the last frame of the animation within the movie clip in frame 1 so that it won't loop.
The problem is that when I test the movie, when you roll over the image on frame 1 it just continually loops between frames 1 and 2 - it doesn't play the animation on frame 2 as I thought it would.
View 3 Replies
Oct 20, 2004
I have a movie clip on the main timeline calledbg_graphics, I want to target a movie clip within that movieclip called bg1_mc. to gotoAndPlay frame 2.The bg_graphics clip goes to a random frame within that movieclip, there are 3 frames. 1st has bg1_mc, 2nd has bg2_mc, and 3rd has bg3_mc. How could i determine which file to gotoAndPlay frame 2 in bg_graphics when i don't know exactly which frame its going to be on, let alone target a movie clip within a movie clip.I used this code to generate the random frame
function randomBg() {
//generate random BG based on random frames within the MC
randFrame = random(3)+1;[code].....
View 7 Replies
Apr 19, 2007
i wanna write a function for the onPress handler for a movieclip that will be created dynamically.. how do i do it? this is what i'm doing:
only the ending part of this loop is relevant, where i am writing the thisMC.onpress function. The trace text never appears..
Code:
for (var i = 0; i<galleryLength; i++)
{
var thisMC:MovieClip = this.createEmptyMovieClip("image"+i+"_mc", i);
loadMovie(gallery_array[i].src, thisMC);
[Code]....
this whole loop is inside the onClipEvent(load) of another clip. So when that clip is loaded, this code is executed..
View 2 Replies
Feb 10, 2010
Trying to target a button inside a mc in order to trigger a swf.the mc is called "nav_btns"the button is called "contact_btn" The swf has the same name as the listener in order to repeat the function with multiple swfs. my problem is, i'm getting an error of an Access of undefined property with my mcI geting an error:"1120: Access of undefined property nav_btns.
my code:
var Xpos:Number = 461;
var Ypos:Number = 294;
[code].....
View 1 Replies
Jun 10, 2009
I loaded this "slider" swf into a "sliderHolder" on my index swf file. inside that loaded swf there's a movice clip called icon_mc. I'm trying to target it and make it go to a specific y position within that loaded swf on a MouseEvent inside the index.swf. I can't seem to make it work.I triedI have traced sliderHolder and it says it's empty.I have traced sliderLoader and it gives a Loader.So how do I access the movieClip if I just have those two as references?Here's what I have and want to do in code:
Code: Select all
var sliderLoader:Loader = new Loader();
sliderLoader.load( new URLRequest("sliding/ImageBar.swf"));
[code].....
View 1 Replies
May 27, 2005
The swf successfully loads where I want it to, but I'm having trouble moving the new movie clip to a specific keyframe in the timeline.
Code:
on (release) {
_parent.productImage.loadMovie("./flash/BT_Closeup.swf");
_parent.productImage.gotoAndStop("set2");
}
View 1 Replies
Jul 28, 2008
I have a function that attaches a movie clip to the stage each time at a new level.
myLevel++
attachMovie("myMovieClip", "instanceName"+myLevel, myLevel)
}
At the moment it works just fine but I want to target specific instances and I can't work out the instance names.I am trying this..
instanceName[myLevel]._x = 400
View 9 Replies
Feb 6, 2009
Trying to add a set of movie clips to the stage in a loop. I need to be able to reference them on a mouseDown function - but the projHolder var in the mouse event is coming up undefined. Any ideas how to accomplish something like this?
for (var i=0; i <intWorkCount; i++) {
var projHolder:MovieClip = new MovieClip();
projHolder.name = 'projHolder' + (i);
[code]...
View 5 Replies
Apr 29, 2011
I am having trouble clearing out a shell movie clip that has other mcs dynamically placed inside it. Something like this;
var myShell:shell_mc = new shell_mc;addChild(myShell);//
//---obviously these buttons are on stage already---buildBtn_mc.addEventListener(MouseEvent.CLICK, buildFunction);clearBtn_mc.addEventListener(MouseEvent.CLICK,
[Code]....
View 4 Replies
Jan 14, 2010
i am using a loop function to generate an place instances of a movie clip on the stage. the movie clips are being used as buttons, they have text in them. here is the code
ActionScript Code:
// butAniMini is an external custom class animating the buttons
var _sideBarBut:butAniMini;
//variables to hold the first buttons x an y position
[code]...
the problem is that i dont no how to set the text in the buttons so u can change the text and add event listeners etc to them
View 3 Replies