ActionScript 3.0 :: Traversing Objects Through Different Classes?

Feb 12, 2010

I have 2 classes Main.as and RedPawn.as (yes, in the same folder).I am wanting to check if a child exists on a movie clip in Main.as through RedPawn.as.This is within a for loop since I am checking 24 possible values for _dest until I find a match.This simplified code example would be in the RedPawn class:

Code:
_dest = 'example_mc'; // example_mc is pulled from an array
if ( MovieClip(root)._dest.numChildren < 2 ) { // do stuff; }

[code].....

View 8 Replies


Similar Posts:


ActionScript 3.0 :: Accessing Objects From Other Classes?

Jan 7, 2012

I want to access an object from a class in which it was not created in. I have a main class (A) in which I create and instantiate an object (of class B), from this class I can obviously do whatever I want with the object, no problem. The issue I'm having is another class (C) needs to access the object in question to change its x and y location values. Class C doesn't know what the instance of class B, created in class A, is; this doesn't surprise me, but I can't figure out how to allow class C to get access to what class A created.

View 7 Replies

ActionScript 2.0 :: Targeting Objects In Classes

Feb 7, 2005

I've got a problem targeting objects is AS2 classes. In a class I have a multi-dimensional array with paths to some mc's in the main timeline (caminho['mc']). I need to reference them via method in a class, so i use something like this:

[CODE]...

View 7 Replies

ActionScript 2.0 :: Traversing 3 Dimensional XmL?

Mar 5, 2010

I have this as xml :

[Code]..

I wanna parse it and install it on in array or an object how do i that?

View 1 Replies

ActionScript 3.0 :: E4X: Traversing Xml Using Attribute Name?

Jul 22, 2010

I have spent multiple hours on it to find no result. Here is the situation. MY xml structure looks like this:

<root>
<RES>
<R N="1">

[Code]....

But I am not able to refer to the corresponding parent <R> so that I can traverse it to retrieve corresponding <SEZ N="name" V="dummy name"/>

View 6 Replies

ActionScript 3.0 :: Traversing Xml Using Attribute Name

Jul 22, 2010

This might sound really simple, but I have spent multiple hours on it to find no result. Here is the situation. MY xml structure looks like this:[code]But I am not able to refer to the corresponding parent <R> so that I can traverse it to retrieve corresponding <SEZ N="name" V="dummy name"/>

View 1 Replies

ActionScript 3.0 :: Traversing Through An XML File?

May 10, 2011

First of all, this is not specifically for homework. It's a project I've been working on for the past few months and I've kinda hit a road block. The short version: I've got a Flash file (which is a DJ program) whose main functionality is to play mp3 files, load the files a user uploads into a web page I made and let the user have the ability to choose which song they would like.

I literally have this almost completed except for this final piece: playing what the user uploads. More details of how I got here: I've got a PHP page that creates (or updates if you wish to call it that) an XML file. I'm not sure which way I should approach it (most tutorials online show AS2 but I've already made my project in AS3 and I've seen it's easier...yet I'm not able to figure this out).

[Code]...

View 2 Replies

ActionScript :: Flex : Mapping Objects To Classes?

Jun 16, 2009

If I've got a bunch of plain old Objects, what's the best way to map them to a bunch of Classes?For example, if I use an HTTPService to pull in some JSON, then deserialize it, I'll have a bunch of objects which look like:

{ type: "person",
id: 42,
name: "David" }

And I want to turn them into instances of a Person class:

class Person {
id:int;
name:String;
}

(also to be considered: how about some standard way of dealing with relationships between objects? For example, if the Person had an additional "spouse" field:

{ type: "person", spouse: 61, ... } // Where 61 is the ID of the spouse
)

View 2 Replies

Flex :: Class - Create Own Classes / Objects?

Dec 7, 2009

When I try to do this in an AS CDATA block, it tells me I can't have a class declared within a class (the MX:Application itself). Makes sense. But where and how do I do it?

View 2 Replies

Flash :: Passing Data Between Objects/classes?

Dec 27, 2010

So i a building a categorized menu of different foods. I have a class for "categories" (buttons) which essentially will return a string "salads", "drinks", etc. I now have another class "menuItems" for items within categories and this handles sizes such as "small", "med", "large", etc. My problem now is that when i return "salads", i want to invoke an array which contains all the elements of salads, send it to menuItems which will populate the menu. So far i have both the category objects and the menu object setup. I just cant seem to be able to send the data that the category object is returning and pass it to the menu object. Both of which are added to the stage as shown below:

If there was a way that i could say add all these classes to one class so that they can talk to each other that would be great but i dont know how to do this.

View 1 Replies

ActionScript 3.0 :: Accessing Objects With Linked Classes?

Sep 15, 2010

So I have a menu built inside of Flash CS4 that has a graphic for a background and five text fields that sit on it for menu options. The whole thing is saved as a movie clip in the library. The text fields all have instance names like infoBtn and mapBtn etc. and the menu is already on the stage and linked to it's own class in the library. My problem is accessing those text fields on the menu from the class. I keep getting "Error #1009: Cannot access a property or method of a null object reference." and the menu doesn't work. But if I trace the infoBtn.text in the class it outputs the text that is in the text field. So the code is accessing it but it's still not working?

Code:
package classes
{
import flash.display.*;
import flash.events.*;

[cODE].....

View 0 Replies

ActionScript 2.0 :: Referring To Library Objects Via Classes?

Feb 26, 2007

I've been heavily mired in 3D recently, and decided to pay a visit back to good ole Flash.

My problem is this. I'm extending the MovieClipLoader class to create a Preloader Class (yes I'm sure it's been done fifty billion times but). I'm trying to refer to a symbol in a common library, the preloader symbol itself.

Inside my class I have this

Code:
function onLoadStart(target){
baseClip.attachMovie("preloaderTemplate_mc", "preloader_mc", 500, {_x:0, _y:20, _xscale:75, _yscale:75});
baseClip.preloader_mc.gotoAndPlay(1);
}

baseClip is a MovieClip object which takes a MovieClip passed to the constructor of the class in the FLA. (say a container movieclip which has a target clip preloaded into it) The class does load the target clip into the baseClip, but doesn't show the preloader, which makes me think I'm not referring to it properly.

View 4 Replies

ActionScript 3.0 :: Why Can't Classes Access Objects On Stage

Jul 22, 2009

Im trying to get used to packages and classes in AS3. Im used to put all code on the first frame of the timeline, but now i have 442 lines of code on the first frame. Yeah 442. And this is for a game engine so i thought i should put it inside some classes to make it easier to read an reusable. But i have noticed that if i create a class called Code and make a instance of that class like this:[AS]var codeObject:Code = new Code();[/AS]i get a bunch of errors because the class cant Acess the stage and the display list.i found a workaround by linking the class to a movieClip and and do this:[AS]MovieClip(parent);[/AS?

View 1 Replies

ActionScript 3.0 :: Classes - Define The Objects & Variables?

Oct 27, 2010

m new to as3 & am trying to make a platform game. i'm just not sure how to define the objects & variables. like my character & any other object i want it to collide with will be sprites, but im not sure where to go from there.

View 2 Replies

ActionScript 1/2 :: Traversing XML File To An Array?

Nov 3, 2010

I'm having trouble interrperting how I should traverse an XML file and pushing it to an array to display the sets of data.

Here is my AS:
myXML = new XML();myXML.ignoreWhite = true;myXML.onLoad = function(ok) {
if (ok) {  alldata = this.firstChild.childNodes; allEntries =

[code]......

View 3 Replies

ActionScript 3.0 :: Traversing A Class Hierarchy?

Jun 9, 2010

I'm currently working on a tower defense game and am in kind of an odd situation. I've programmed it in such a way that a large class hierarchy is in place. It's like this StartScreen class ---> BaseLevel class ---> GUI class ---> TowerPlacer class(towers are stored in an array in this class) ----> etc.My problem is that i need to access an array in BaseLevel from my GUI class, is there any fancy trick for doing this? or have i screwed myself over.

View 2 Replies

Flex :: Storing Instances Of Classes In Shared Objects

May 26, 2010

Is it possible to store instances of a class in a cookie or in shared objects.

Basically in my application I have an object "Diagram" that the user can create. If they hit save, I want to store the current instance as a cookie and allows them to reload it later.

Alternatively, I could see about getting them to store the saved version on the hard disk. But even then, all I want to save and retreive is my actionscript object.

I've tried storing the object to SharedObject.data.diag, but when I try to retrieve the object from the cookie doing SharedObject.data.diag as Diag returns null.

View 1 Replies

Flash :: Objects Still Created When Omit Importing Classes?

Oct 2, 2011

I'm working through a tutorial to create an mp3 player in actionscript. When I delete my first 4 lines of code, the .swf still works great! I thought you needed to declare what classes you're importing for every object you create later on.

import flash.events.MouseEvent;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.media.SoundChannel;

[Code]...

View 1 Replies

ActionScript 2.0 :: F5: Create An Array Of Values Not Objects / Classes?

Mar 11, 2005

I was wondering if I can create an array of created Classes. I have a feeling that I cannot, and that you can only create an array of values, not objects.

View 2 Replies

ActionScript 2.0 :: Assigning Tween Classes To Objects In An Array?

Jan 11, 2006

My array has a few objects that are revolving like on a carrousell...I want them to react on my mouseclick.I cant seem to get this to work...how would one make objects in an array do things?I cant even define the path to them properly, it appears that I SUCK. Allow me to present to you my little code-turdthat wont work in a million years level0.holder_mc.dot0.onRelease = function() {var xScaleT:Tween = new Tween(dot0, "_rotation", back.easeOut, 0, 1222, 2, true);

View 4 Replies

ActionScript 3.0 :: Using Classes To Add Objects To The Stage With Fluid Layout

Oct 20, 2009

I am using Gaia framework with a fluid layout at here is what I get

This is the error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.gaiaframework.FluidLayout::FluidObject/reposition()

[Code]....

View 7 Replies

ActionScript 3.0 :: Traversing XML Object From YouTube Data API

Sep 18, 2011

I am experiencing problems when trying to traverse XMl returned from the youtube data api.I can trace the XML but cannot access any of the nodes, not sure where I'm going wrong, I have tried various methods including parsing JSON format from youtube but to no avail. I thought it maybe the namespaces so I replaced these using a script to replace them as attributes. A snippet of returned XML is below:
[Code] .....

View 2 Replies

Actionscript 3 :: - Access Objects Instantiated In Flex App's MXML File In Other Classes

Jul 29, 2011

I've got an object declared and instantiated in my Flex application's singular MXML file: public var CDN:CDNClass = new CDNClass; I would like to access this same CDN object (and its public methods and properties) in another class declared in a separate .as file as such:

[Code]...

But when I try to access the public method parsePlayList in the CDN object in a method in the class defined in the .as file, I get the following error: Access of undefined property CDN The reason I want to do this is to break up the logic of my application into multiple AS files and have minimal MXML files, probably only one.

View 2 Replies

ActionScript 3.0 :: Access Other Objects On Stage In Flash Inside Of Two Custom Classes?

Jan 13, 2009

I have a CustomSimpleButton class and a CustomSprite class which creates a bunch of CustomSimpleButtons and displays them at runtime. How can I access other objects on the stage in Flash inside of my two custom classes? If I want an object tween to occur when one of my custom buttons is clicked how do i reference the object that I want to tween if I'm inside of my custom class.

View 0 Replies

ActionScript 3.0 :: Traversing Display List Hierarchies In An Easier Means

Apr 15, 2011

I've been searching around forever trying to find a way to make traversing nested display lists more of a 1-line possibility.In AS2 you could grab a clip just by _container.clip1.nestedclip2.nestedclip3 and it was blatently simple.In AS3, is there any way to do that?So far my only methods are keeping a class level reference to important parts of the UI or doing a painful series of getChildByName chains until I drill down to it:[code]The casting makes the getChildByName method possible.

View 15 Replies

Java :: RemoteObject In BlazeDS Environment: Serializing Objects From JAXB / XJC-generated Classes

May 10, 2011

I'm developing a webapp with Java backend and Flash (pure ActionScript) frontend using BlazeDS. I'm using the RemoteObject stuff to send objects, using custom serialization, where I need to implement Externalizable (Java) and IExternalizable (AS) interfaces. This works fine so far.

But now I need to send objects from Java to Flash, whose classes are generated with JAXB/XJC. Of course these generated Java classes don't implement the Externalizable interface, so it seems that I can't use my approach here. One possibility seems to be writing a XJC plugin which makes the classes implement Externalizable. But this looks like a tough job...

View 2 Replies

ActionScript 3.0 :: Detect If Flash Created Some New Instance When Traversing A MovieClip Timeline?

Nov 10, 2011

Without trying to explain the odd issue i am seeing, is this possible?

View 9 Replies

ActionScript 3.0 :: Flash When Is It Worth "splitting" Similar Objects Into Different Classes?

Apr 22, 2012

I'm about to start on a side-scrolling game which will involve around 10 different characters the play could choose from and probably about 20 different enemies. Each of these will have slightly different graphics, movement speeds, attack rates, etc. but I'm wondering how to manage it. The way I see it there's two options: Have a general classes "Player" and "Enemy" with a setter method for the exact character which could set a bunch of class variables like speed, max health, etc.. Most of the code would be the same but I'd need a lot of "if" statements in some places (ranged attack vs. sword, etc.).Have a whole bunch of classes "Goblin", "Scarecrow", "Skeleton", etc. that inherit from "Player" or "Enemy". All the stats could be hard coded in individual classes, no need to perform multiple checks on which character it is, but there will inevitably be some code repetition.

I'm bearing in mind that I'll have to reference these regularly. For example, each "Player" will probably have a "target" class variable to track who it's moving towards/attacking. If I strongly type this as "Enemy" and then set it to an instance of "Goblin", for example, will it be cast to "Enemy"? Is that a bad thing performance wise? What about using Vector.<Enemy> for tracking objects on screen? I'm guessing I'll have the same casting issue if the actual objects I push there are instances of Player's sub-classes. Will it negatively impact performance to have ~30 extra classes if I go with option 2?

View 3 Replies

Auto-import As3 Classes (internal/intrinsic Flash Player Classes At Least) Using Emacs?

Aug 23, 2011

Is there any way to auto-import as3 classes (internal/intrinsic Flash Player classes at least) using Emacs ?

Looked for as3-mode and actionscript-mode but nothing working was found. as3-mode can import class if it is opened in buffer (but not *.mxml files)

View 1 Replies

ActionScript 3.0 :: Unexpected Errors, Multiple Helper Classes, Extended Classes?

Jan 9, 2010

The examples I'll use don't do anything - they're classes without ANY members - no variables, methods, anything.

Let's say I extends Sprite and call it MySprite.

I save it in test.core

[code]...

Now I create another custom class called MyWindow that extends MySprite.

I save it in test.windows

[code]...

Then I create another class that extends MyWindows (the example I'll use is a document class - but that doesn't matter - I've tested using an instance too).

[code]...

Notice that I'm not even trying to instantiate the helper classes - just having them there throws the error.

If there is only a single helper class, everything runs fine.

Also note that - as far as I can tell - this only happens when extending one class from another package, then extending that class with more than one helper object.I'm pretty sure there's no namespace bumps or typographical errors, as this is a very pared-down version of the original application.

EDIT: seems the problem exists even without the crossing packages - even extending MySprite in the document class with multiple internal classes generates this error.

View 4 Replies







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