ActionScript 3.0 :: Target Movieclip From Document Class?

Dec 17, 2010

i am making a drag drop game. i created a doc class for the dragged items . i want to make the hit test with some movie clips on the stage but inside the class they are not seen by there names. how to perform my hit test

this is my code,and target1_mc &target2_mc are movie clips on the stage

package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;

[Code].....

View 5 Replies


Similar Posts:


Falsh :: Target MovieClip From Non-Document Class?

May 11, 2010

is there any way to target a MovieClip from an external class that's NOT the Document Class?

Is it correct to have the Document Class as Main AND View?

View 1 Replies

Actionscript 3 :: Can A Document Class Extend Another Custom Class That Extends MovieClip?

Aug 16, 2011

If I have a Document class that extends MovieClip, and I want to use it as the basis for another Document class, is it possible to create a subclass that extends the main document class and use that for a different FLA?

For example,

fla1.fla has a document class of MyMainClass:
public class MyMainClass extends MovieClip
fla2.fla has a document class of MySubClass:
public class MySubClass extends MyMainClass

I've tried, but now I'm getting errors that all of my variables that reference stage instances aren't being found.

View 1 Replies

ActionScript 3.0 :: Referencing A Textfield Inside A Movieclip Class From Document Class

Feb 3, 2009

Ok, this is one of those walls that I know once I can jump over it, I will be a much happier developer again.

I've done tons of reading, and think I have a firm understanding that the general consensus is that if you want to reference something, it needs to be added to the display list, using addChild().

I hate to be defiant, but what if I don't want to?

Or at the very least, what if I want to add a movieclip class to the stage using addChild, and then reference objects inside it?

It is much easier this way than what most people recommend - adding 15 objects via addChild, then setting the x and y for the, etc.

That said, I'm all about using classes and using as3 the way it was meant to be used. So what this is, is a best practices question I guess.

HERE ARE THE STEPS I'M TRYING:

- Create new flash document

- Draw graphic symbol bg, with text field over it, select them, convert to movieclip symbol, and export class name "box", then delete it from stage

- Add document class .as file, which simply adds that class "box" from the library, to the display list using a simple addChild()

- Set a name for that box using box.name = "test" let's say

- Do a simple trace like the following - "getChildByName('test').textFieldName" - it shows up great

- So then, I'll now try to set the text by doing this - getChildByName('test').textFieldName.text = "yo";

That last line above, is what doesn't work. I know I'm referencing wrong, but how would a pro as3 developer, reference something on the stage within a movieclip class, from the document class?

View 1 Replies

ActionScript 3.0 :: Reference Movieclip On Stage From Custom Class Of Document Class

Dec 7, 2009

Is there a way I can reference a Movie clip I have on the main stage from a custom class of a document class?[code]

View 1 Replies

ActionScript 3.0 :: Call Function Of Document Class From MovieClip Class

Aug 8, 2008

How can I run function of the main document class from a class of a MovieClip? I usually just used MovieClip(parent).function(), but now my MovieClip has another parent. Or what do I have to pass to the MovieClip class when creating the MovieClip to acess the main document class?

View 9 Replies

ActionScript 3.0 :: Reference Movieclip On The Stage From A Class Of The Document Class?

Dec 8, 2009

Is there a way to refer to a Movieclip on the stage from a class file of the document class

Lets say I have 3 MovieClips on the stage(a Circle, a Square and a Triangle)

I have the document class which calls another class that controls the MC on the stage

Example

ActionScript Code:
package {
public class Example extends Sprite {
//Create the instance of the class being called

[Code]....

View 1 Replies

ActionScript 3.0 :: Access A Movieclip On Document Class From Another Class?

Mar 3, 2011

Going 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]......

View 4 Replies

ActionScript 3.0 :: Flash - Dispatching An Event From One Document Class And Listening For It Via Another Document Class?

Dec 14, 2010

I am dispatching an event from one document class and listening for it via another document class.My code in class A.

Code:
this.dispatchEvent(new MYEvent(MyEvent.APERTURE_DONE));
trace("Dispatching APERTURE_DONE");

my code in class B.

Code:
addEventListener(MyEvent.APERTURE_DONE, onDoorsOpen,true);
trace("Lisetning for APERTURE_DONE");

[code]....

My listener is registering before the event is dispatched, based on my output window, however I never get the "Open Doors" trace statement to fire.

View 2 Replies

ActionScript 3.0 :: Document Class Wants Movieclip?

Oct 20, 2009

I have a document class but if i extend sprite i get an error:

Code:
package {
import flash.display.Sprite;

[code]......

View 5 Replies

ActionScript 3.0 :: Target MovieClip That Class Extends?

Jun 22, 2011

Is there any way to get the name of the MovieClip that a class extends?Lets say I have an MC on stage called boxMC exported for AS using a class box which extends MovieClip.If I trace (this) within my class I will get the name of the class, if I trace (parent) I will get the name of the main MovieClip that boxMC sits within. So how can I target boxMC?Basically I want to be able to return the name of the MovieClip that the class is extending

View 2 Replies

ActionScript 3.0 :: Reference Main Document Class From Document Class Of Loaded Swf

May 7, 2011

I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on).For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf. HOW do I reference the Main class? I can't find a way.[code]and dispatch an Event this way from the loaded swf document class to the Main class:[code]Now, first of all I don't know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.

View 9 Replies

ActionScript 3.0 :: Access Document Class From Within Movieclip?

Jan 30, 2009

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.

View 1 Replies

ActionScript 3.0 :: Access Document Class Var From Movieclip?

Sep 18, 2009

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.

View 1 Replies

ActionScript 3.0 :: Target Movieclip On The Stage From Custom Class

Dec 18, 2010

this is the code  and the movieclips are target1_mc & target2_mc
  
package {    import flash.display.MovieClip;    import flash.events.MouseEvent;    import flash.text.TextField;
public class recipeMC extends MovieClip {

[Code].....

View 1 Replies

ActionScript 3.0 :: Target/control .fla Movieclip From .as Class File?

Jun 18, 2009

I have a Bullet class - which defines and controls the firing of bullets (and works perfectly in all ways) - and now I'd like to add to it the ability to detect if it has hit a spaceship-movieclip sitting in my main .fla's timeline - what's the proper syntax to do this?

here's my code:

Code:
public function moveBullet(e:Event): void {
this.y = this.y - 20; // moves bullet up-screen, shooting vertically
if (this.y <= 0) {

[Code].....

View 8 Replies

Actionscript 3.0 :: Target Movieclip Instance On The Stage From Class File

Dec 12, 2009

me only still learning as3, i've checked google there and back, but somehow i can't find the answer for this: how to target a movieclip instance which is already on the stage from within a class file? i mean, targeting it from the document class file is easy, but what is i want to target it from another class file?

View 2 Replies

ActionScript 3.0 :: Accessing A MovieClip From An External As That Is Not The Document Class?

May 9, 2009

Instead of posting my entire files and such, I'll make a brief example of my situation and my desired outcome. My files consist of my document class entitled Engine.as and another class Abilities.as all within the same folder. On my stage I have a MovieClip with the instance name of item1_mc. On its personal timeline I have 2 frames, one entitled "inactive" and the other "active". Here's a sample of very similar code....

[Code]...

View 4 Replies

ActionScript 3.0 :: Reference Sprite Or Movieclip In Document Class

Dec 9, 2009

How do I reference MovieClips or Sprites created in the Document class from a custom class?[code]But I have a lot objects I want to reference so using the above method would take to long.I know I can do this to reference a MovieClip on the main stage from a custom class.[code]Would referencing the sprite created in the document class be similar?

View 1 Replies

ActionScript 3.0 :: Calling Document Class Variables In A Movieclip

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

Flash :: Access A MovieClip On The Stage From The Document Class?

Jan 7, 2010

I 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 Replies

Actionscript 3 :: Referencing A Document Class From A Child MovieClip?

Apr 13, 2010

I have a document class with a child MovieClip on the stage. I have the clip already on the stage because it's part of an complex layout provided by the designer and it seems easier to leave it on the stage than to use addChild (since I would have to add about 60 objects).What is the best way to reference the document class from inside the child MovieClip class?

View 1 Replies

Flash 9 :: Access Document Class Methods From Within MovieClip?

Aug 27, 2008

Let'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 Replies

ActionScript 3.0 :: Create A MovieClip Inside Document Class?

Jul 22, 2009

I'm using Flash CS3. Inside my document class, how can I create a child MovieClip that loads an image from a URL? what I did wrong? I tried changing the Main class to a Sprite, still not working.

[Code]....

View 2 Replies

ActionScript 3.0 :: Reference Document Class From Inside MovieClip?

Aug 11, 2009

I'm trying to reference the document class from inside a MovieClip that's dynamically added to the stage. I'm using this script:
Code:
documentClass(root).someVar;
Where "documentClass" is the name of my class (duh).

This works fine, however -- when I move the class file into a folder (and make all the necessary revisions to point to the file) this doesn't work (everything else still does). I get a "not found, possibly undefined method" error. The class name is technically com.documentClass now, how do I point to that? The file is an Adobe Air file.

View 5 Replies

ActionScript 3.0 :: Reference Sprite Or Movieclip In Document Class?

Dec 9, 2009

How do I reference MovieClips or Sprites created in the Document class from a custom classI know I can do this

ActionScript Code:
//Sprite I want to reference
var orange:Sprite  = new Sprite()

[code].....

View 1 Replies

ActionScript 3.0 :: Accessing A MovieClip From An External File That Is Not The Document Class?

Apr 17, 2009

Instead of posting my entire files and such, I'll make a brief example of my situation and my desired outcome.My files consist of my document class entitled Engine.as and another class Abilities.as all within the same folder.On my stage I have a MovieClip with the instance name of item1_mc. On its personal timeline I have 2 frames, one entitled "inactive" and the other "active". Here's a sample of very similar code....

Code:
package
{
import flash.display.MovieClip;

[code]....

How do I access item1_mc? In reality I have 6 different clips and I desire to access much more than frame changes...what's the overall best way to be able to interact with an item placed on the stage via an external .as file that is not the document class?

View 11 Replies

ActionScript 3.0 :: Call Document Class Function From A Movieclip On Timeline

Jun 25, 2009

I have a function defined in my document class that I want to call on a framescript of a movieclip placed on a timeline. Of course, left to itself it's "undefined", and I can't figure out how to reference parent/root/document class.

View 4 Replies

ActionScript 3.0 :: Reference A MovieClip On Root Timeline From Document Class?

Sep 28, 2009

So I have a MovieClip symbol created in the Flash IDE with a baseClass of flash.display.MovieClip and Class name of "Square". I have placed it on the timeline of my fla at frame 30 and given it an instance name of "square". How can I control that MovieClip from my DocumentClass? I have an ENTER_FRAME listener listening for the arrival of frame 30. At that time I want to simply do something to the "square" MovieClip. But I keep getting a compile-time error of "1119: Access of possibly undefined property square through a reference with static type flash.displayisplayObject.".

[Code]....

View 1 Replies

ActionScript 3.0 :: Document Class Not Work When Shift MovieClip To 2nd Frame?

May 24, 2011

All my content is at 1st frame of my FLA file...and I'm using Document Class When I try to shift my content to 2nd frame, so I can use 1st frame for preloader.. but its not working.
 
This is my document class... Basically at 1st frame I'm loading external jpg image to a MovieClip.Is it possible, I can **** my MovieClip and other content to 2nd frame of the timeline.

[Code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved