ActionScript 3.0 :: Can't Use This Class Inside My MovieClip

Nov 21, 2011

The attached SlideshowExample.as file works quite nice when I use it on stage directly. But when I tried to use it in Gallery_mc movie clip, it doesn't work

View 3 Replies


Similar Posts:


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 :: Class Movieclip Inside A Movieclip?

Mar 29, 2009

I would like to be able to load in my mcs with class objects attached inside a different movieclip on the stage called game

currently i spawn my mc like this - vertex = new Ball(); -and it loads them to the stage, how can i load them into the game mc

I want to do this because i use a giant mc with my game inside to scale and move around to simulate zooming and panning of a camera

View 2 Replies

ActionScript 3.0 :: Move A Movieclip From Inside A Class?

Nov 11, 2010

I'm just starting with as3 object oriented programming -- i've always liked the idea, but could never "see" how the whole objects/classes worked with actual game development.in my fla file i have this...

Actionscript Code:

var moveBob:MoveMan =new MoveMan()

in my MoveMan.as file...

Actionscript Code:
package  { public class MoveMan {  public function MoveMan() {  bob.x = 5 } }}

and on the stage i have a movieclip with the name set as "bob" If i use this line in my fla file... bob.x = 100 it works.But when i try to move the movieclip inside the class i get this.1120: Access of undefined property

View 1 Replies

Flash :: Instance Class From Swc Inside A Movieclip

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

ActionScript 2.0 :: No Access To MovieClip Inside Class

Aug 17, 2009

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

View 1 Replies

ActionScript 3.0 :: Reference A Movieclip Inside Another Class

Dec 13, 2010

I'm making a sidescroller for school and im trying to get my hit test working.

I'm having trouble because I'm not sure how to properly reference an movie clip that i added in my game engine (zombie_mc), to a seperate class for my bullets the code for adding my zombie to the stage

Quote:

if (zombieTime < zombieLimit)
{
//if time hasn't reached the limit, then just increment
zombieTime++;

[Code]....

View 4 Replies

ActionScript 3.0 :: Access Object Inside A MovieClip From A Class?

Jan 4, 2011

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.

View 9 Replies

ActionScript 3.0 :: _Deleting_ A Movieclip From Inside Its Own Class (not Using RemoveChild)?

Mar 7, 2009

I have started learning AS3 after a long stint doing work on AS2, and to test my abilities, I decided to make a quick breakout game. It has gone fine so far until I get to the part where I need to remove the bricks when they are hit. My current code for the class of a Brick is attached, and is started when a Brick is minstantiated on the Stage. However, when I use:

parent.removeChild(this);

it makes the Brick invisible but the AS3 code still runs and the ball bounces off where the moveiclip of the Brick used to be; the eventListener for ENTER_FRAME I added still runs even though I have deleted the MovieClip. This doesn't work either:

this = null;

I have to say I don't like the whole Garbage Collection idea of AS3; it seems half-hearted and uncontrollable; being a .NET developer I am used to more control than this. What was wrong with "this.removeMovieClip();" and how can I correct this? My current swf: http:[url]....(there are other things wrong, like bad collision detection,

View 3 Replies

Actionscript 3 :: Adding A MovieClip From Inside A Class Method?

Jun 15, 2010

I have been trying to add a movieclip to my .fla file from a class.my main fla file: main.flaactionscript file: script.asthey stay in the same directory.script.as file as follows:

package {
import flash.display.*
public class MyClass extends MovieClip

[code]......

View 1 Replies

ActionScript 3.0 :: Access MovieClip Properties From Inside A Class?

Jul 18, 2009

Is it possible to access properties from a movieclip on the stage from a class attached to another movieclip?[code]...

View 1 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 :: Connect To The Same Class From The Stage As Well As From Inside A MovieClip?

Aug 7, 2011

How do I connect to the same class from the stage as well as from inside a MovieClip?

In other words: I've set a document class in my properties panel - I cannot access the class's methods from inside an MC. Why?

What are the different ways to connect a fla-file to a class (as-file)?

I've been playing around with AS3 for a few years now, but always avoided classes. But now the day has come for me to finally trying to get a hold of it.

View 1 Replies

ActionScript 3.0 :: Button Inside MovieClip Linked To A Class?

Oct 8, 2011

I am making a game in Flash CS4 using AS3. This is the point. I have a MovieClip called Menu which holds a button with instance name ButPlay. Menu MovieClip is linked to Menu.as script. This is whats inside the Menu.as:

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

[Code].....

When i run the animation i get the this error: TypeError: Error #1009: Cannot access a property or method of a null object reference. at Menu()

When i try to trace the ButPlay inside the Menu i get null object.

View 5 Replies

ActionScript 3.0 :: Reference To A Movieclip On The Stage From Inside A Class.as?

Jan 21, 2009

How do I reference to a Movieclip on the stage from inside a Class.as?

View 1 Replies

ActionScript 3.0 :: Access Properties Of A MovieClip Inside A Class?

Apr 11, 2012

I want to turn my previous background in a platform game with his alpha as 0, so i tried this[code]...

View 14 Replies

ActionScript 3.0 :: Turn On CacheAsBitmap Inside Class That Extends Movieclip?

Nov 15, 2010

I've recently started using the cache as bitmap switch on my on-stage movieclips, to great success, while creating my isometric RPG. What I can't grasp though, is how to apply it to AS-instantiated classes/object.How can I turn on cacheAsBitmap inside a class that extends movieclip? Alternatively, how can I do it from outside the class, from another class that adds mentioned movieclip to the stage?

View 1 Replies

ActionScript 3.0 :: Class Inside MovieClip Giving Runtime Error?

Mar 18, 2009

I'm trying to place an instance of a movieclip (instance name: tehMovieClip) from the library within another movieclip (instance name: parentMovieClip) on the stage. tehMovieClip, the movieclip going inside another movieclip, belongs to a class called CollisonDetection (linkage properties, class:CollisonDetection, Base Class: flash.display.MovieClip). When I put tehMovieClip inside parentMovieClip, I get this runtime error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

If I just place tehMovieClip on the stage by itself, it works fine but I need it to be inside parentMovieClip.

View 6 Replies

Flash :: Access A Symbol From Inside A Class Extends Movieclip?

Oct 14, 2011

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 ?

View 1 Replies

ActionScript 3.0 :: Flash Need Buttons Inside Movieclip Call Function In Main Class

Nov 16, 2010

I'm having some trouble finishing an interface i'm working on,the function indica() adds a menu listing of items (indicadores) inside a mask because its too large, and i added a scrollbar that allows to scroll through the items but now i need to add the buttons inside the movie clip indicative,i can add symbols and buttons, but i'm having trouble having them call functions inside the same class that the function indica() is running.[code]

View 2 Replies

ActionScript 3.0 :: Flash Button Inside MovieClip Inside MovieClip Doesn't Dispatch Event

Jan 25, 2012

I have a Button that is inside MovieClip1 which is inside MovieClip2; yet when i click the Button it doesn't dispatch Event.

View 5 Replies

ActionScript 3.0 :: Calling A Function From An Extended Class Inside A Top Level Class

Sep 23, 2009

package{
public class Character{
protected var _hp:uint = 50; //Character Health Points
protected var _power:uint = 5; //Damage dealt

[Code].....

I`m instancing a Character and a Player in the Main Timeline, all in frame 1.
When I use: ""player.attack(character)"" it works fine by itself.

So I added the if (defender._hp <= 0) this.win() which gives me the following error:

1061: Call to a possibly undefined method win through a reference with static type Character.

"defender" is a Character instance, "this" is a Player instance and "win()" is a Player method. I try to call the Player method inside a Character method using the Player instance adding the "." and his method name

Do I really need to define the win() function in the Character class? Is there a bypass to use a subclass method in a parent class method if it`s called from an instance of the subclass?

View 6 Replies

ActionScript 3.0 :: Moving A Child From A Class To A Holder Sprite Inside That Class?

Feb 12, 2009

i have a BasicMap.as that takes an Array and populates itself with the MC objects passed to it by a String reference.it inherits from Sprite, and so it just places the objects on its self.then i have a class that inherits from that class, and gives a little more functionality to it, but in order for it to do that, it needs to place the objects not on itself, but instead inside a holder Sprite, so here is my problem:

code:
package Mushroom{
import flash.display.Sprite;

[code]......

View 8 Replies

ActionScript 2.0 :: SetInterval With A Class - Function Doesn't Work Inside Class ?

Oct 7, 2004

I was wondering why my current code for calling a setInterval on a function doesn't work inside my class.I have this code inside one function, calling a second function.

intID = setInterval(selfReferential, dupe, 30, 0x000000);

The selfReferential keyword refers to the current class,but was defined previously (selfReferential = this; ).I get no errors, but the dupe() function is never called.and I had the selfReferential variable replaced with the this keyword at one point as well.

View 5 Replies

ActionScript 2.0 :: Make Class Instances Into Listeners And Broadcasters From Inside Each Class?

Jul 8, 2007

I want to know how to make class instances into listeners and broadcasters, from inside each class. Here is what I am trying specifically... part of the Proj class... (projectiles, as a matter of fact)

Code:
private function listen():Void {
u.register(this);
onUpdate = function(){
step(); // a function I have which makes the projectile move (not shown)
}
}

where "u" is another class, the Updater class with this code...

Code:
class Updater {
// const. --- make this a broadcaster
public function Updater(){

[code]....

PS: What is the syntax for using AS2 code tags instead of just "[CODE|"?

View 2 Replies

ActionScript 2.0 :: Instantiating Character Class Inside Of Game Class

Feb 18, 2007

I am having a problem instantiating a Character class inside of a game class.I am working on converting URL...l these tutorials to A.S. 2.0.[code]

View 2 Replies

ActionScript 3.0 :: Dynamically Create Class Inside A Class?

Apr 19, 2010

This is what i'm trying to do :

I have 1 class that extends movieclip, let's call it Class0. I have 1 class that extends movieclip, let's call it Class1.

I create an instance of Class0 on stage like : var myClip0:Class0 = new Class0(this, "Class1");

The class Class0 when initializing, will create a new movieclip (myClip1) and add it as child, as an instance of Class1, like myClip0.myClip1. But it's when i create that clip, i want to tell it, it's an instance of Class1, like :

private var myClip1:Class1 = new Class1(this);

Where Class1 could be any class.

How do i pass Class1 to Class0 so it can create it dynamically?? Do i have to use the apply function??

inside Class0, i have a function that does :

Code:
if(subClass){
initSubclass(subClass);
}

[Code].....

View 8 Replies

ActionScript 3.0 :: Create Movieclip Class That Subclasses Another Movieclip Class

Sep 3, 2010

I want to create a movieclip class that subclasses another movieclip class and inherits all its properties (rather than having to rely on the include statement). In my project I'm using:An abstract parent class that extends a movieClip: "infantryDroid".[code]However everytime I try this, flash acts as though nothing was imported from the parent movieclip class.If I was to try the above code I would get the message that _root and speed (which were defined in the parent class) "are undefined".

View 6 Replies

ActionScript 3.0 :: Class Instantiation Inside Class?

Dec 24, 2009

Performance wise, is it better to instantiate inside or outside the constructor?

Code:
public class example {
private var _mc:MovieClip = new Movieclip();

[code]......

View 4 Replies







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