ActionScript 3.0 :: Access A Movieclip From Class File?
Jul 30, 2011I am trying to access/target a movieclip on the stage in my .FLA file from a AS3 class file Main.as but I can't get it to work.[code]...
View 7 RepliesI am trying to access/target a movieclip on the stage in my .FLA file from a AS3 class file Main.as but I can't get it to work.[code]...
View 7 RepliesI am currently using an external Class file for an instance in my .fla project. It creates an instance of that specific class and has it carry out some functions.I want to access a MovieClip on the stage in the .fla file in the external Class file. How can I do this?For example, the Class file creates an instance of that class, and I want the x and y coordinates of that instance to be equal to that of let's say circle_mc. Now circle_mc is on the stage of the .fla file, and therefore cannot be accessed. How can I get around this?
View 5 RepliesGoing further on my app, I felt in another problem. Despite having lots of posts on the web regarding this, none of the solutions worked for me In my document class (Main.as) ve two containers. One empty and another with a star that is being imported from the library. Here´s the main class:
package
{
import flash.display.*;
[code]......
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 would like to tell a movieclip on the stage to be visible from a class.
View 1 RepliesI took a template to create a flash game using AS3 and it uses a class that first runs a movieclip where the game is played. So when the game runs, I set a countdown timer to count down from 60 to 0. When it hits 0, I want to go to another movieclip.
Unfortunately, I have no idea how to access the other movieclip.
My code are as follows
Code:
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.TimerEvent;
[Code].....
public class MyClass extends MovieClip {
public function MyClass():void {
my_mc.addEventListener(MouseEvent.CLICK, action);
}
private function action(e:MouseEvent):void {
[Code]...
I can't able to access the my_mc(placed in FLA) movieclip. How do I access?
I can't acces my MC that was created inside my class. 've got a MC "bttn" on my stage, if u create an instance of the BttnClass a copy of the MCbttn is made and given an other position, than I want to play the bttn's(contains multiple frames) and NOTHING happens. The Bttn's are copied,but I can't play them. So my class works but how can I play my buttons?
Class file:
ActionScript Code:
class Bttn {
//variables
private var num:Number
//constructor function
public function Bttn(i) {
[Code] .....
So i have a movieclip with a textfield in it. Also there is a class for this Movieclip. This all is exported to a swc that is linked into other projects for reuse purposes. However I cant access the textfield from classes in other projects. I get the 1009 error. Even when accessing ti from the Added to stage event.
View 3 Replieshow can i access a movieclip with a instance name via a class i have tried this: public var player:MovieClip;
else if(this.hitTestObject(player))
{
this.y = player.y
}
How can i access a movieclip via its instance name in 1 class [code]...
View 3 Replieswhat do i put on the normal timeline of the MouseControlled.fla file to target the character that moves around? Like if I wanted to start coding some objects it might hit that I have on the root native timeline how do I reference it?
View 3 RepliesBasically, I want to access a movieclip child created in a function called 'main' in my 'main' class that links to the fla.
Code:
var player:Symbol3 = new Symbol3();
addChild(player);
[code].....
I was wondering if it was possible to access the document class from within a movieclip.
I am creating a slideshow type project, and I'm using a document class to switch between the frames using the arrow keys. However, in one of the "slideshow screen" movieclips, I want to have it stop, and then play another part when the arrow key is pressed again.
I tried to access my nextScreenToPlay method within the document class, but whenever I try to do it within a movie clip, I get this error: Call to a possibly undefined method nextScreenToPlay through a reference with static type class.
If I do a trace(Main), within a movieclip, it shows the class.
trace(MovieClip(root).TRACE);
so at pesent I am using this to try and access
Code:
public var TRACE:String
in the the document class.
however I am getting this
"1180: Call to a possibly undefined method addFrameScript.�"
my document class extends to Sprite as I have some stage resizing that occurs on Initialise
Code:
StaticInheritance extends Sprite
Im sure it has something to do with the way the document class extends.
I've created a custom class (not the document class, otherwise there would be no problem) and I want to be able to access a MovieClip that is sitting on the stage.
How? MovieClip(parent), MovieClip(root)... don't work. What's the proper procedure?
Also, can I pass the MovieClip from the Document Class to another custom Class?
I wrote a custom class and I need it to change the attributes of movie clip for me, not sure how the syntax goes, this is what I thought was right, but om a newbie:
[Code]...
I have a movie clip symbol placed on the main timeline. The class linkage to that movie clip is Sheet. Inside Sheet class, I make a public string call _textRow. Inside the Sheet's constructor, I create a new TextField call values_txt. Inside the Sheet class again, I create a public function call updateTable().
The document class is Main. From the Main.as, I need to call updateTable() function to update the text inside values_txt. And I need to find a way to get to values_txt. That's where my problem lies.
Actionscript Code:
package{//imported stuff herepublic class Sheet extends MovieClip{public var _textRow:String = " Lorem
Lorem again";public function Sheet(){addEventListener(Event.ADDED_TO_STAGE, initSheet);}public function
[Code]....
Basically, I need to run Sheet's updateTable() from Main.as and update the values_txt.text with _textRow string. But I don't know value_txt's target path.
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 have a "box_mc" movieclip on the root of my stage and I need to select it from within my Document Class. I thought Stage.getChildByName("box_mc") would work, but it just returns null.
View 2 RepliesLet's say I have a FLA file with document class called main. In main, let's say I have a method called test1 that just outputs "hello world" via trace. On the FLA I have a movie clip. In that movie clip, when the timeline reaches frame 123, I want it to invoke the test1 method (I just set up a simple action on the frame). However, I get an error saying that the method is undefined. I try this.parent.test1() too but that gives me the same error. Is it not possible to invoke a document class property from within the timeline of a movie clip that's on the stage?
View 2 RepliesIs it possible to access properties from a movieclip on the stage from a class attached to another movieclip?[code]...
View 1 RepliesI have created Movieclip in main actionscript file main.as :
var drawingSign:Movieclip = ne MovieClip();
drawingSign.x = 40;
drawingSign.y = 40;
How could I access it (add listeners etc.) from a class file?
I have a movieclip library symbol exported for ActionScript with name McFloor and identifier McFloor and I'd like to access it from OneChart class.
[Code]...
I want to turn my previous background in a platform game with his alpha as 0, so i tried this[code]...
View 14 RepliesIt seems simple, but it doesn't seem to be working I have 2 as3 files as classes "mainclass.as3 (this is the document class)" and GamePlay.as3
the GamePlay class works flawlessly on it's own, but when i try to create the var to access it ... var gp:GamePlay=new GamePlay(); ... i get the following error.
I have looked at tutorial etc, but i cant get it to work i am currently getting the following error.[code]...
in my class I declare a linked movie clip:
a_mc = new LinkedMC ();
trace(a_mc.testString);
and on the time line of LinkedMC: var testString = "test string"; but I can't access testString.
I created a movieclip symbol and exported to actionscript, I created the .as file:
class BRIQUE extends MovieClip
{
function BRIQUE()
{
[Code].....
"graphics" is an image imported on the stage inside my symbol, but it seems not to be accessible this way (I get an error), nevertheless it works this way in as3 then what is the right way in as2 ?
I have created a game in flash, and due to the nature of the game, I have many movieclips placed on the stage manually in Flash CS4. They are not programmatically added as children to the stage, and so I am having difficulty getting access to them in the document class. So far the only method I have been able to use is to do stage.addChild(active_area); (for example), but there are many movie clips, all very differently named, so this method seems incorrect.I've discovered that my MovieClips are not children of the stage, but in fact MainTimeline, as when I for loop through stage.getChildAt(i);, only one child, root1, is traced out. How can I access movieclips that were placed on the stage in the timeline from the document class, without having to manually add them as children to the stage? So it looks like my problem wasn't that I couldn't access the MovieClips, it was that I wasn't modifying the MovieClips' values, so I wasn't registering any change in them.
Here is the code after I fixed it:
function manage_cursor(e:Event):void {
prevX=currX;
[code].....
I want to know how you access a variable within the fla file from the Document class?I want an int inside the fla or swf file to be accessed from the class that is being used to run the file?
View 5 Replies