IDE :: Access The Maintimeline From Within A Movieclip?
Aug 20, 2009is there a way to access the maintimeline from within a movieclip?
root. doesnt seem to work
is there a way to access the maintimeline from within a movieclip?
root. doesnt seem to work
i have a MainTimeLine.as Document Class using as3 in flash cs4.it beginning looks like:[code]where the as file is declared in the Document Class of the primary fla file. under this primary fla file, i have a MovieClip symbol which points to another fla file. well this file declares a Class Linkage and i can access the properties and objects of the embedded symbol fine from the MainTimeLine.as script file.however, i have the above public player variable defined, as shown above, in the MainTimeLine.as code.i am having trouble accessing the player properties/methods from the embedded symbol fla file. how do i do that?
View 5 RepliesI need to access an array that's on the maintimeline from with in a movie clip im having issues with it.
The variable has all its info on the maintimeline but doesnt show up when i reference it in the movie clip So i tried referencing to the array var thumbURL:String =parent.thumbs ; and var thumbURL:String =root.thumbs ; but got an empty variable.
I have a .as class which calls an event function. When the event fires, I'd like the MainTimeline to play..
View 9 RepliesI want to define a function on the maintimline and then from inside a movieclip I want to call a function.
In AS2 simply doing this could achieve the resuly _root.callFunction() but this is not possible in AS3
Short version : Im confused on the difference between the two when accessing something on the stage from a package. Longer version: I passed in a ref to the stage to the constructor on a class, and was unable to use it to access a dynamic text on stage. I pass in this instead and am able to access it.
[Code]....
Here's the scenario: We have a creative team that operates in Flash CS5.5 and produces SWF assets which have both graphics elements and actionscript code in them, and an engineering team which authors .as files and builds "code SWFs". The code SWF files must load or embed the creative assets and interact with the code therein for our apps to function.
For iOS mobile development, there is another consideration - it is not possible to load runtime code in an AIR app packages for iOS because of Apple TOS (see related question). Hence, it is not possible to use a Loader to load SWFs in an iOS environment and retain their code.
Embedding a SWF into an ActionScript file the standard way results in a Loader that loads the embedded SWF directly as bytes. This results in access to the top-level, main timeline as follows:
[Code]...
I keep getting the #1009 error coming up, i checked that everything was on my stage and was named correctly.This is the error message that comes up:TypeError: Error #1009: Cannot access a property or method of a null object reference.at Videogame_fla::MainTimeline/loop()Here is my code:
var carrot:Number = Math.floor(Math.random() * 460) +0;
var carrot1:Number = Math.floor(Math.random() * 460) +0;
var carrot2:Number = Math.floor(Math.random() * 460)+0;
[code].....
I'm loading a few external swf's into my file at runtime using load().Once each one is loaded I run a function on it to search through it's children.I use code similar to below to iterate through all the children and check if the name contains a particular string and then perform a function on it.
Code:
for(var k:String in theMC){
if(k.indexOf("character")==0){
[code]....
I need to remove a MovieClip from the stage completely and keep it that way. The following code works just fine but when I come back to that frame later the MovieClip is there again.
Code:
removeChild(myMovieclip);
I am loading a 29 frame movieclip on fame 15 of the main timeline. Is there a way to have it continue playing maintimeline when it finishes. So when it gets to frame 20 of the movieclip AS sends control back to frame 16 of the maintimeline.
View 1 Repliesim trying to get back from a MC into my maintimeline:
i have a mc in wich i have buttons i have access them with the following:
function fn_logotipo_over(MouseEvent) {
movimentx=new Tween(MC_menu.btn_logotipo,"x",Regular.easeOut,-77,90,1,true);
}
MC_menu.btn_logotipo.addEventListener(MouseEvent.M OUSE_OVER, fn_logotipo_over);
Ok now that im inside that i want to navigate back so i can have access to other buttons that or outside of this MC and on the main timeline.
I am new to AS3 and I am going insane trying to figure this out. I have a blank (new) AS3 document, 00pixels x 200 pixels, with one (the first) frame.
[Code]...
what I'm trying to do is accessingsnapText = scrollPane.source.textSnapshot;from an external swf. I've tried:
trace("-->: "+scrollPane.source.textSnapshot.getText(0, 1000));
trace("-->: "+myLoader.content.textSnapshot.getText(0, 1000));
trace("-->: "+mc.textSnapshot.getText(0, 1000));
[code].....
I have almost everything working as confirmed through tracestatements, but when I insert my gotoAndStop("frame labels") in theAS file, there is no effect on the app.I know the button is working because inside the AS file I amtracing the button name to the output panel and it is correct. Ialso have assigned a Switch Statement to the clicked event in theAS file and that is correct also. It traces the correct outputs.But inside the Switch statement, where the gotoAndStop islocated it is not moving to the frame label. It doesn't move atall.I have tried the following:
this.gotoAndStop("label");
stage.gotoAndStop("label");
root.gotoAndStop("label");
this.stage.gotoAndStop("label");
I have an external swf called "lakefillpreloader.swf." It works, except when I put it in another swf, called lakefillwireframe. I get Error#1010 for the lines about ButtonMode and the EventListeners that gotoAndStop at different frames. What do I add to my code?
Lakefillpreloader:
Code: Select allclose_btn.visible=false;
buildings_text.visible=true;
//defines measurements, in pixels
const PANWIDTH:Number=10061
[Code].....
Found several suggestions, none of which have worked. I am sure I am probably overlooking something really stupid, so I need another set of eyes to look at my code. I have a main.swf that preloads and loads an intro.swf. On the intro.swf there is IntroMC that contains skip_btn. When the user clicks skip_btn, I need to call a function named traceMe() from the document class of main.swf. If you look at the comments for the intro.swf code, you can see the error I am getting.
Here is the code for main.swf
Code: Select allpackage
{
[code].....
I've been trying to get a numeric value from an MC to the main timeline but cant seem to figure it out, i have tried "trace" and it works so i guess there should be a way to get a numeric value back to the timeline from an MC.
View 1 RepliesI have an external swf that I've placed in an empty movie clip using loadmovie into the main movie.
The swf shows and plays fine, however I have an interactive movie clip which does nothing when loaded into the main movie. (note: the loaded .swf is fine when tested outside of the main movie). How do I target the external .swfs interactive features after it has been loaded into the main timeline?
here's an example:
code in the external .swf-- on a movieclip, instance name: growObject
onClipEvent (enterFrame) {
if (_root.grow == 1 && this._xscale<300) {
[Code].....
I just need to figure out how to activate these instances while watching the external swf from my main movie timeline.
How do i go about calling a function in frame 1 of my timeline from a class file?
my function TEST on frame one of main timeline is just using a trace.
This is my error:
1061: Call to a possibly undefined method TEST through a reference with static type flash.displayisplayObject.
I have manually created a empty mc on the maintimeline named 'loadme'. I have my buttons in a movieclip that is on stage and within that mc i have the follwing code to one of the buttons:
[Code]....
I get an error 1119 when I run the swf. Also, is it possible to declare the variable for 'loader' on the maintimeline and then use it in my buttons mc?
Working on an RPG type flash, and I have to be able to control a text-box from quite a few locations. The one that is causing me trouble is the inventory. I need to be able to access the textbox with an instance of "statusWindow" from within the inventory clip (instance name "inventory"), so when I mouse over an item within the movieclip it will change the status window on the stage.In this instance I want to mouse over inventory.invHealth from the main timeline to get the display.itemName and itemProps are strings containing information about the item.I tried the following but it gave me a "possibly undefined" error.
invHealth.addEventListener(MouseEvent.MOUSE_OVER, itemStats);
function itemStats(e:Event):void
{
root.statusWindow.text = itemName+"
"+itemProps;
}
how can i access a movieclip via its instance name in another Movieclip class?
and a nother question how can i access a movieclip via its class name in another movieclip class?
BTW i want to access the movieclip child
i am creating a package, MainTimeLine.as, to extend my main timeline. i use the FLVPlayback component under the package. however, i get the compile error:
1172: Definition fl.video:FLVPlayback could not be found. so i added the "import fl.video.FLVPlayback;" line to my MainTimeLine.as file, but flash gives the above error. now i had this problem when i added this code directly under a frame of the main timeline until i added a FLVPlayback instance to my library. now, i am trying to simply embed all of the code under the MainTimeLine.as file and have the as file encapsulate all of it. but, i still get that error.
so, how do i get flash cs4 to recognize and use the import properly
I have a movie clip button inside another movie clip. I want that movie clip button to take me to the main timeline, frame 1 (or any equivalent that would you restart the .fla).
View 2 RepliesI have four movie clip instances inside an instance. ("root" or "stage" > mcInstance1 > mcInstance2)
I have my actionscript codes enterd on the first frame of the mainTimeline.but my knowledge on actionscript 3 is so short I couldn't control the mainTimeline from the instances which I have created as buttons by actionscript coding.Here's what I'd like to do: When one of the movieclip instance is clicked and onEnterFrame,I want another movie clip instace to play which is on the mainTimeline (or "root" or "stage") on top of everything.I even tried to loadMovie and addChild to the stage onEnterFrame of the movieclip instance, but since it does the loadMovie inside instance stage, it appears only on top of the same movie clip instace and not on top of everything else.how to control a movie clip instance on mainTimeline inside the movie clip instance onEnterFrame in AS3.
I've got a dozen movie clips on stage, each with 3 children, and each of those have 8 children, as example named u01-u08.
Is it possible to access u01 directly without the parent names? like a wildcard? like the xml way of getting to nodes with a .. ?
sort of like: stage..u01.alpha = .5;
I'm making a fighting game and so far all the controls are good, characters can walk, run attack etc. My problem: The character is a MovieClip, Guy, and is exported to a class Guy. In Guy.as I have a boolean "hitting" which is set to default "false". If the Guy object hitTests an enemy while "hitting" is true, the enemy will take tamage.
In the Guy MovieClip there are about 7 frames, each with its own animation. 3 of those frames are attacking animations in form of MovieClips, i.e, if we click them we get another set of frames. Say one of the attack MovieClips has 10 frames in it, frame 7 of 10 is where the punch actually lands, this is when I want the enemy to take damage, not before (while the character is still moving his hand forward). Seeing as this frame is inside a MovieClip which is inside another MovieClip(Guy), is there a way to access the property "hitting" with this inner frame?
I have managed to load an external text file in one place one the maintimeline. I would like to do the same thing on other frames. When I go to duplicate the same thing that I did on the first one I get a duplicate textReq request. Do I need to give the textReq a more specific name for each section? When I did this the movie wouldn't even recognize and of the code that was working before.I am attaching link so you can see sections I am talking aboutAlso you will notice that the swf file I loaded won't go away. That's another problem...ugh.Here is code on maintimeline:
stop();
import fl.transitions.*;import fl.transitions.easing.*;
import flash.net.URLRequest;import flash.display.Loader;import flash.events.Event;import
[code].....
The current problem with my code is everytime I press the play again button in frame 4 and I restart my game it goes twice as fast. So I asked my teacher and she told me it's something with the EventHandlers but I didn't used them in my code.She's of no help to me currently. Yes, education over here is worthless in a certain amount.. Personally I think error lies in this code: I also get the error called: TypeError: Error #1009 about a null object. It's at the MainTimeline/ enter_frame()..
import flash.text.TextField;
var upPressed:Boolean = false;
var downPressed:Boolean = false;[code]...........