ActionScript 2.0 :: Instance A MC From Inside Another MC To Root?
Jul 20, 2009
I'd like to be able to instance an MC that is within another MC to the stage. I understand how to duplicate things in the same path and how to attach from the library. However, for the unique situation that I have in my project I'd like to instance from inside a MC to the root.Pseudo example:contatiner1 and projectile1 are MCscontainer1 parent is the rootprojectile1 is inside container1Create an instance on the root of projectile1
View 2 Replies
Similar Posts:
Apr 16, 2011
I placed a movie clip instance inside a button, and I want this movie clip to play when the button is released. I'm using this code on the frame containing the button:
function playMovie(event:MouseEvent)
{
this.theButton.theMC.gotoAndPlay(3);
[code].....
View 2 Replies
Nov 15, 2010
I have declared a object in my 1 st frame of application.
ActionScript Code:
var objTest:Test = new Test();
I am tring to access the object from a movie clip. Movie clip is located in frame 2. I am getting error
ActionScript Code:
this.parent.objTest.IncrementCount();
trace(this.parent.objTest.QuestionCount);
1119: Access of possibly undefined property objTest through a reference with static type flash.displayisplayObjectContainer.
How to access a object instantiated at root from a movie clip.
View 1 Replies
Feb 25, 2010
I have declared a object in my 1 st frame of application.
ActionScript Code:
var objTest:Test = new Test();
I am tring to access the object from a movie clip. Movie clip is located in frame 2. I am getting error
ActionScript Code:
this.parent.objTest.IncrementCount();
trace(this.parent.objTest.QuestionCount);
[code].....
View 4 Replies
Mar 10, 2012
i tried to jump to the root and then to sepecific label and if in that label in the root enter in a instance my cod eis something like this.
[Code]...
View 3 Replies
Nov 16, 2010
I have declared a object in my 1 st frame of application.
ActionScript Code:
var objTest:Test = new Test();
I am tring to access the object from a movie clip. Movie clip is located in frame 2. I am getting error
ActionScript Code:
this.parent.objTest.IncrementCount();
trace(this.parent.objTest.QuestionCount);
[code].....
View 3 Replies
Feb 2, 2005
I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.
var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();
[code]....
View 2 Replies
Jun 6, 2010
I am trying to create a gallery where each thumb is housed inside of it's own movie clip that will have more data, but it keeps failing because it won't let me refer to the newly created instance of the movie clip. Below is what I am trying to do.
var xml:XML;
var xmlReq:URLRequest = new URLRequest("xml.xml");
var xmlLoader:URLLoader = new URLLoader();
[Code]....
It dies every time on that last line. How do I refer to that vidThumbn instance so I can add the imageLoader? I don't know what I'm missing. It feels like it should work.
View 2 Replies
Jan 14, 2011
I need some help in Flash As2. I have an animated movie clip that has a button inside it. The idea is to be able to click on the movie clip and get it to run the animation (with on(release){ gotoandplay(2);} as its code) and then stop on frame 10. So far that is working fine as it should.
Where im falling down is that on Frame 10 there is a new symbol (Attractions_button (This has an instance name)) that I want to be able to click and take me to a frame on the main time-line.
With some research into this I cannot find a solution. So far I have labeled the frame i wish to link to on the main time-line as NRM and have tried the following code on the button symbol itself:
[Code]...
View 1 Replies
Apr 12, 2010
how can I call an MC on root timeline from a button inside another MC?
View 1 Replies
Dec 6, 2010
I have this in my fla (Actionscript 2)
import com.pw.Pts;
var gUnitId:String;
I have this in Pts.as
class com.pw.Pts {
function Pts()
{
trace ("Inside constructor");
[Code]....
I want the variable gUnitId in the fla file inside the class file.
View 5 Replies
Feb 11, 2011
I´m starting to learn flash cs5 a couple hours ago. Currently i´m learning how to use layers. Imagine that I put a rectangle and an elipse inside layer 1. Then I create a new layer with a photo. How can I see the list (root) of objects that are inside each layer? I know that I can use the outline color to visually identify them but is it possible to see the objects as a root?
[Code]....
View 6 Replies
Jun 15, 2011
Is it possible to pull the currentFrame of the root timeline from inside an object class? Normally a currentFrame call only checks the frame of the movieclip it's attached to within an object class, so how would you go about checking the frame of the entire project from within the object class file?
edit: Nevermind, I found what I was looking for. All you have to do is use MovieClip(root).currentFrame and it works just fine. Consider the question answered.
View 1 Replies
May 8, 2008
I have a Nav Bar on my _root timeline. Inside of which I have buttons and MC's. I want to have all the code for my buttons on the _root timeline. So, I can adjust from there.
Below is an example of what I'm trying to do from the _root timeline Actions Layer:
Code:
// ------ NAV BAR ON MAIN STAGE -----------------------------------
// ------ Instance Name = NavBar ------------------------------------
// ------ Button inside of "NavBar" = MyButton ----------------------
[Code].....
View 8 Replies
Feb 18, 2009
I've been working on a new issue while giving a break on cracking the other one.I have a movie clip acting as a button with rollover/rollout animation- we'll call it menu_mc for simple reference.I'm basically creating a rollover submenu. I've set it up a few different ways but the most user friendly has been hiding the submenu_mc (which has 4 linked buttons to root frame inside) by doing:_root.sub5_mc._visible = false;then inside the menu_mc with the rollover I have the submenu trigger set to show: _root.sub5_mc._visible = true;The links are working fine but the problem I am running into, is that the rollover state, once over the submenu_mc, does the rollout function and leaves the submenu_mc hanging there by itself- still functioning perfectly.You can go back over the menu_mc and it will play out the rollover again.On the other simple animated buttons (which do not have submenus) I have coded:
on(rollOver) {
_root.sub5_mc._visible = false;
}
[code].....
View 3 Replies
Oct 21, 2009
How can i access a function, from the root, that is inside another movie clip?
_root.mc_1.mc_1_1.mc_1_1_1
Inside of the mc_1_1_1 is a function called test_me.How can i call that same function from the root?
View 1 Replies
Aug 4, 2011
In fact, when i publish my FLA with player 9, there is no prob. When i publish with selecting player 10, there is this problem.
I paste my code :
var leng:int = MovieClip(root).program.websiteXML.pages.titlePage.length();
trace ("leng"+leng);
setInterval(function () : void {
[Code]....
View 11 Replies
May 20, 2003
here is the fla file - [URL] I have an attached movie on root level that movie has a button inside it and I want to tell that button to do some function. simple----BUT I want to put the action on the first frame on the root and not inside th MC. here is the code Iam working on and the same is in the fla file in the above link.
[Code]...
explanation of the above code-- but1 is the button on root that tells clip1 to attach on blank MC(thats also on root) clip1 has the button inside it call but2 and tried to tell that bloody but2 to open that the URL link but its not doing so NOTE - I want to put all the action on the action on the first frame and not inside th MC.
View 1 Replies
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
Aug 27, 2004
i have a quick question what is the syntax if u want to use parametrs to define a path inside a path? i mean:
[CODE]...
does anyone know.... it's very important!
View 6 Replies
Nov 20, 2009
how do you access a button inside a movie clip by instance name? i want to add an event listener to the button.
i tried:
Code:
myMovieClip.myButton.addEventListener(MouseEvent.MOUSE_DOWN etc......
and got no errors but at the same time it didnt respond to my event listener
View 4 Replies
Feb 3, 2011
i'm trying to use compiled assets and code from a swc. Inside a new fla I select the swc to be included when exporting. When create the instance in the timeline of the code works and I can see assets that are inside the swc and trace a propertie from the same object. The problem is only when doing the same inside a movieclip, can't reach the assets (movieclip) but I can still trace properties from the class. I've uploaded the working files: master.fla is the one that creates the swc. template.fla is where I test the swc. files (This are cs4 .fla + .swc + .as)
[Code]....
View 2 Replies
Sep 2, 2011
I've created a button in Flash, and inside that I have a TextField and a MovieClip, both with instance names set. They cover all 4 frames of the button, with no keyframes.I found I couldn't access the objects using the instance names I'd set, so I used this piece of code to see what's going on:
var obj:DisplayObject = this.m_graphics.btnChange.upState;
for ( var i:int = 0; i < obj.numChildren; i++ )
{
[code]....
View 1 Replies
Oct 30, 2010
So, this is my thought-process:
First, I make an Array to hold all my Buttons. Then I make a loop and throw all the instances of the Buttons inside.
ActionScript Code:
var TextButtons: Array = new Array(); //my container for the buttons
for (var j:Number=0; j<6; j++){
var mb: menuButton = new menuButton(); //button created
[Code]....
Every works up to here and looks pretty sweet. Then things get tricky. I would like to be able to create Text, specifically tlf, as part of the instances of the Buttons, so that when I mouseOver the text is grows and shrinks proportionally with the Button. I'm stumped, and exhausted my knowledge of AS3. I tried to make a separate array with TLFTextFields, and things just got funky. I am using TLFTextField, because there is an option to make them read-only. Somehow I need to make them inside the Buttons.
View 0 Replies
Jul 24, 2007
I have defined a variable attached to a move clip via Mc.OnLoad = function *etc so is it possible to access this variable from within the move clip ?
View 2 Replies
Sep 11, 2008
I have a movie clip that needs to loop inside a movie clip in Flash. Would someone post the code to paste into the ActionScript window? The .flv has no skin on it. I have done this so that I can put the video file outside of the Flash movie.
View 2 Replies
Jun 3, 2010
I have several movie clips labeled thumb0, thumb1, thumb2, etc.
How do I refer to these instance names inside a for loop? I want to do something like:
//DISPLAY THE THUMBNAILSfor(var thumbCount:int = 0; thumbCount < loadedThumbs.length; thumbCount++) { ["thumb" + thumbCount].visible = true;
}
View 8 Replies
Jan 23, 2011
I've set up a game, where the user has to guess what a picture is by moving a small hole/ portal around.I've used the mask feature to do this and managed to attach the portal to the mouse.However,I need to stop the mouse dragging the portal when it moves outside of the picture/instance.This is so the user can then press buttons to go back to main menu etc. Here's the code I've used to attach the portal
onClipEvent (load) {
startDrag("", true);
Mouse.hide();
}
View 1 Replies
Nov 11, 2011
I bought Flash recently and I'm getting started on making a game, a platform shooter game, thing. What I have, is a button on the main stage that I want to activate a function in an instance. But that instance is inside a symbol. So it's Stage->Character->Gun. But if I put down:
Shoot.addEventListener(MouseEvent.MOUSE_DOWN, Fire);
//Shoot is the button on the stage
function Fire(evt:MouseEvent):void{
Derp(); //This being the function I want to be activated
}
This is the code in the Gun instance:
function Derp():void{
//epic code goes here
}
It will give me an error saying "1180: Call to a possibly undefined method Derp." So basically it's telling me it can't get to this code because it's not on the same stage. How can I get an instance to be recognized by all code in my project, regardless of we're it is in the project? I want to keep all my symbols where they are, so external ActionScript file won't be good if I have to recreate the object on the stage.
View 3 Replies
Mar 10, 2012
I've started to Flash again after a long time. I'm excited. Whatever, my problem is simple. I want to reach a instance name from a movie clip. For example, I made a movie clip that has 2 frames. Name of the second frame is "secFrame". There's a movie clip inside the frame(i'm talking about the frame that named as "secFrame") that has a instance name as "mcSecFrame". Also the instance name of the main movie clip is mcMain. Now, the problem is, how I can control the mcSecFrame instance name with the code that is written on the mainTimeline's frame? For example, I want to control its frame rate. I wrotethis:mcMain.secFrame.mcSecFrame.frameRate = 5;But it doesn't work.
View 13 Replies