Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Objects And Properties :(



Im having a hair pulling moment here with little simple things -

ActionScript Code:
var ball:Object=new Object(); var prop="radius"; trace(ball[prop]);
the book says that the trace resolves to "Radius" -no it does not resolve to radius, but to undefned. Where is my mistake? I think that the prop does not know it belongs to ball so this is why i get undefined ?

Also, for reading properties:


ActionScript Code:
ball.prop="Radius";ball.x="adsa";trace(ball[prop]); for(var prop in ball){trace(ball[prop]);}
is it absolutely necessary to write (var prop in ball) when it works with only (prop in ball) ? what is the var reffering to then?




I apologyze for these questions they may seem stupid and I am aware of that



Ultrashock Forums > Flash > Flash Newbie
Posted on: 2006-06-13


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Javascript, Objects, And Properties
After searching forever because I know someone else has had this problem I am left to create a new post.

Background: I have a mapping program that acts as an observer. When the user drops below 5,000 feet, the observer should detect and turn on a button that allows the user to turn on the orthographic photos. I created the button and named it btn_ortho. Realizing that I couldn't reference it from javascript, I changed the button into a movie and named it mov_ortho.

Problem is I still can't get javascript to find the object/movie/button so that I can change the visibility.

Below is what I believe the code should be.

var map=getMap();
var mgScale=map.getScale();
var MapMovie=parent.seal_area.seal.seal;

if (mgScale <= 5000)
{
var dontknow=MapMovie.TGetProperty('_level0/mov_ortho', 0);
alert(dontknow);
}

I realize this has nothing to do with visibility, but I'm just trying to get javascript to see an object within the main movie.


I've tried:
'_level0/mov_ortho/btn_ortho'
'_root/mov_ortho'
'_root/mov_ortho/btn_ortho'
'_parent/mov_ortho'
'_parent/mov_ortho/btn_ortho'
'etc,etc,etc,.....ad infintum'

Arrays As Properties Of Objects
I have a custom object which has both numbers and arrays defined as properties in its prototype. When I delete an instance of the object, the numbers are deleted as expected, but the arrays are not, and keep their value to the next instance of the object created. Are arrays allowed to be properties of objects, and if so, any ideas why the arrays hold their values, and how I can fix it.

tks

AS2: Adding Properties To Objects
To create an Object that has a property that is an array in AS1 we can do:

Code:
person = new Object();
person.children = new Array();
person.children[0] = 'Ruby';
person.children[1] = 'Red';
.
.
.
When I try the same thing (adding the datatype) in AS2 I get complier errors.

Code:
private var person:Object = new Object();
private var person.qID:Array = new Array();

Objects - 2 Word Properties
i am testing a new db design to load objects
can i make an object property 2 names, like:

object.date added = aDate;

maybe like:

object.[ date added ] = aDate;

anything like that, or do i have to make them one word?

thanks

Objects Properties Still Connected...
For something I'm making, I need to have a copy of an object that contains many objects within more objects...An object within other objects gets deleted peice by peice and here is my problem...
code: a={}
a.b={}
d=a
trace(a.b)
//traces [object Object]
delete d.b
trace(a.b)
//traces undefined

//different test
a={}
a.b={}
a.b.c={}
d={}
d.c=a.b.c
trace(a.b.c)
//traces [object Object]
delete d.c
trace(a.b.c)
//traces [object Object]

//another test
a={}
a.b={}
d=a
trace(a.b)
//traces [object Object]
delete d
trace(a.b)
//traces [object Object]
So, you can probably tell my problem is I want to make a copy of a whole object, but if I alter a property of the object and not just the object itself, it affects the original also. I don't want that to happen. But if I define them individually all the properties it doesn't happen. Do I have to run through many for in loops or is there an easier way? Thanks...

[FMX] Calling Properties Of Other Objects
Ok, here the code that I have


//Object 1
function object1() {
this.txt = "It works!";
}
object1.prototype = new MovieClip();
Object.registerClass("object1", object1);

//Object 2
function object2() {
}
object2.prototype = new MovieClip();
object2.prototype.onEnterFrame = function() {
trace(object1.txt);
}
Object.registerClass("object2", object2);

attachMovie("object1","object1",1);
attachMovie("object2","object2",2);

Now when I add the objects, im getting "undefined" for the value of object1.txt, and I have no idea what else to do =.
Thanks in advance for any help.

Getting Movieclip Objects And Properties From The Stage
Is there a way to capture movieclip objects and their properties from the stage programatically? For instance, I have two movieclips ("square1" and "square2" with instance names "square1instance" & "square2instance"). I'd like a user to click on a button after repositioning and maybe changing the color of the squares. I would now like to collect the movieclip names, instance names, and properties (like _x and _y) for each instance to be send to ASP via the loadvars() object. Is this possible?

Referring Objects And Properties Thru Timelines In AS3
Hi,
i´m trying to reach a property (like "enabled", or any other one) of a movieclip that is in the MainTimeline, from another movieclip in the MainTimeline also, so, i´m using parent keyword to reach the MainTimeline and then getChildByName("menu_mc") to reach the movieclip named "menu_mc" (instance name, in flash ide)...

then the code returns the movieclip correctly, but if I try to change or read any property of the movieclip class it just throw an error...

does anyone know how can i solve this?

thanks
Chan

Setting Properties On Predefined Objects?
In AS2 it was possible to set new properties on objects, for example:

ActionScript Code:
var mc:MovieClip;
mc['myReminder'] = "What I want it to be";

AS3 wont allow me to do this, but I would very much like to know if there's any good solution?
I'm using a Dictionary at the moment. So I have an entry in the dictionary, that will represent my own custom property. But this dosn't really seem to be the right thing to do, and in the long run it will not work.

Any ideas? Or is it possible, I feel I've missed something basic here?

Calling Objects Based On Properties
How can you call objects based on properties they have instead of object names? For example if i want all the objects in an area to move somewhere else. Thats not what im trying to do but just an example. Also im using flash mx 2004

Accessing Properties And Methods Of Like Objects
Hello.

Is there a straightforward means of limiting access to a class's properties and methods to other instances of that class? For instance, say we have two instances of the Example class. Is there a way to allow one instance to access certain properties of the other, but to prevent any instance of any class that is not Example from accessing the same properties? (That includes non-Example classes in the same package as Example- I know about the internal namespace. But I like the way you're thinking.)

I'm tempted to do something with custom namespaces, but I'm not very experienced with them. Any ideas?

MX2004PRO[AS2.0] Cycling Though Objects And Their Properties
I am trying to do something like the following ( it doesn't work, I receive an error:**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: Expected a field name after '.' operator.
_root.["object"+_root.i].one = ["a"+i].one
Code:
var object1:Object = new Object();
var object2:Object = new Object();
var a1:Object = new Object();
var a2:Object = new Object();
a1.one = "one";
a2.one = "two";
for(var i= 0 ; i < 2; i++){
_root.["object"+_root.i].one = ["a"+i].one;
}
Does anybody have any suggestions?

How Do I Refer To Instanced Objects Properties
I am generating 2 particles (objects) in a for loop. What I get are two instances named by actionscript (instance2 and instance4). Pictures of my code are below (2 files: main.as and particle.as).






After compiling above code I am getting an error like on the picture below (I am assuming it can't recognize object name).




If I move trace(circle[1]); from a loop back to particle(inc) function I am able to refer to object partialy like on the pictures below, but trace is not only checking circle[1] but also circle[0] for some reason.





If I use trace(instance2 or instance4); then it is totaly not recognizing objects, look below

Adding Properties To Custom Objects. Bizarre.
Flash has gone mad. I have built a couple of scripting object types that I use for signalling, one of them has nine or ten properties that I created and registered successfully using the addProperty() method.

Then I tried adding an additional property called "is_active". It seemed to work fine, but when I checked the code, I also found a function I had left in for the same object called "is_active()".

The function was overwritten by the property and did nothing, but when I removed the function, the property was no longer registered and no longer worked.

I changed the name of the property a few times to test, but each time, I could only get the property to work by adding a function - any function - of the same name.

I have checked, rechecked, rewritten and rebuilt the strange functioning code, I have even tried using the getter/setter functions in other properties. No joy.

This is very very bizarre, I suspect that the file may be corrupt, but has anyone else come across something similar, and equally important, managed to find the cause/resolve the problem?

Gaius

Creating Objects With Variable Number Of Properties
I am building an object with a variable number of properties. First the fixed properties:

obj=new Array();
obj.title="demonstration";
obj.text="objects with varying number of properties";

Now, depending on the data loaded, the number of properties change. In pseudocode:

obj.["item"+i]= "car";
obj.["item"+i+1]="SUV";

Also, how would I access the properties?

Thanks!

Why Is The Debugger Dropping Its View Of All My Objects & Properties
Hi,

The debugger is really important for me to fix my problems. For some reason now, when I debug my movie, I have litttle time to get to the object I'm looking for before the view of all the objects in my hierarchy disappears from the debugger, and I am left with just global.

Why does this happen? How can I fix this.

Thanks in advance,

lisa

Help Needed: How To Create Multiple Objects With Same Properties
I need to know how to create multiple objects with same properties and that can be collectively referenced to in ActionScript. For example, if I want to create a mc that bounces off of any one of 20 different other mc's, how would I do that without writing the code for each instance name. It's a problem that's been annoying me for a while now. I would love some help. Thanks.

[CS3] [AS2.0] Class Constructor Changes Private Properties Of Other Objects
I am creating classes for a 3D environment. One such class is outlined below (with irrelevant code excluded):


Code:
class Object3D {

private var pos:Array = new Array();

private var mc:MovieClip;

private var cam:Camera3D;

private var projection:Array = new Array();

public function Object3D (target:MovieClip, usingCam:Camera3D, xPos:Number, yPos:Number, zPos:Number) {
mc = target;

cam = usingCam;

this.pos['x'] = xPos;
this.pos['y'] = yPos;
this.pos['z'] = zPos;

positionMC();
}

public function positionMC ():Void {
projection = cam.projectMe(pos);

if(projection.visible){
mc._visible = true;

var xCenter = Stage.width/2;
var yCenter = Stage.height/2;

mc._x = xCenter + projection.x;
mc._y = yCenter - projection.y; //Flash has its y axis running the wrong way so use a minus

mc._xscale = mc._yscale = projection['scale']*100;
}
else
mc._visible = false;
}
}
All that the constructor does is receive some values and store them in private arrays and then call another another method which projects it onto a 2D plane (using another object).

I instantiate the objects and attach them to MCs (node0 - node5) already on the stage as follows:


Code:
var cam:Camera3D = new Camera3D(100, 0, 0, 0, 0, 0, 1); //don't worry about what these parameters do

var mClip:Array = new Array();
var mObj:Array = new Array();
for(var m=0; m<=5; m++) {
mClip[m] = _root['node'+m];
mObj[m] = new Object3D(mClip[m], cam, Math.random()*200-100, Math.random()*200-100, 60+Math.random()*100);
}
This places each MC into some random position in 3D space.

However I have discovered that each time I create a new Object3D it overwrites the private pos array of all previously created objects. I have checked that the other methods aren't at fault and it is something to do with the construction of the object.

Any ideas what would cause this?

Help Strict Datatype Dynamic Objects And Their Properties
I'm creating a bunch of objects dynamically in a for loop:


Code:
for(k:Number = 0; k < someothernumber; k++) {
this[nomObj + k] = new Object();
this[nomObj + k].subname = "some string value";
}
How can I strict datatype the object declaration and the property? Is that possible? If I use the colon syntax for strict datatyping, the code breaks.

I found this thread, but it doesn't really discuss strict datatyping of the object properties:

http://www.actionscript.org/forums/s...light=datatype

Thanks for your help -- this is one of my first true AS 2.0 Flash projects, and I'm trying to be diligent with the strict datatyping.

IronChefMorimoto

Access Properties Of Objects In A DisplayObject Container
Hi all,

i was wondering :

lets say we have a displayObject container which holds several children movieClips. How would one access the properties of one of its children IF the children are dynamically created using a for loop ? Ive been looking for this for a while, and im quite sure there's a simple solution for it, but i cannot find it. Ive tried setting the .name property of the children but to no good. Anyone who can point me into the right direction ?


ActionScript Code:
var container:Sprite = new Sprite();
var testmc:MovieClip = new MovieClip();

container.addChild(testmc);
addChild(container);

trace(container);
trace(container.testmc);
trace(container.testmc);

when i test this out quickly, the trace of the container returns the correct object, but the testmc, which is a child of container returns undefined ?

i think i have a totally wrong idea about the displayObject concept so if anyone could "enlighten" me that would be fantastic !

thanks a lot
Juan

Accessing Properties Of Objects Stored In 2D Arrays
I'm looking to put together a bit of code that dynamically scales a field of movie clips based off of the user's mouse movements. I have the code that scales a single movie clip written, and I've filled a two-dimensional array (an array filled with other arrays, which are in turn filled with objects, which have clips attached).

So my question is: how do I access the properties (scaleX and scaleY, specifically) of those movie clips?

Thanks, and much love.

How Do I Trace The Properties Of An Object's Properties?
I forgot to put it in the title so I'll just place it here; I am using AS 2.0. I know that there are other ways to accomplish the goal that am after, but I was wondering if anyone knows of a way to access the properties of an object's properties?

Here is the code that I thought of, even though it doesn't work

var a:Object = new Object();
a.bproperty = 0; //lowerlevel properties
a.cproperty = 1; // lowerlevel properties
var d:Object = new Object();
d.e = a; // upper level properties

for(var i in d){
for(var j in d.i){
trace(i + " = higher level lower level= " +j);
}
}

I know that you can enter the following code to view the 'lower level' properties of d.e:

for(var i in d.e)

This really just boils down to how I am organizing the code(I have ideas on what do next, and i am 99% sure that I can get them to work), and if there is a way to dynamically access the properties of the objects properties, It will save me from creating yet another large block of code for my project. If you want to see the unfinished project, go to http://www.garrettchristopherson.com

Store And Retrieve Array Of Custom Class Objects From Shared Objects.
Hi,

I am stuck up with a problem in ActionScript 2. I am using Flash MX 2004 on windows XP.

I have created 3 custom classes say Parent, Child, and GrandChild. Parent class contains in it an array of its Child objects. Similarly each Child object contains in it an array of GrandChild objects. Also I do have one global array of all the Parent objects.

I want to store this array to the shared objects on specific events(say exiting the session) and then reload them from the shared object(on next session startup). I am able to store the global array to the shared object but when I try to retrieve the same array from shared object, I could not do it. The retrieved array is not of my custom class type [Parent].

Help needed to solve this problem urgently. Does anybody have idea how to do it??

Thanks in advance.



Cheers,
Naishadh Sevalia

Objects Talking To Objects, Parent/child Communication, Scope
I've been using AS3 at an intermediate level, and am getting deeper
into classes. I'm loving classes! I'm just cloudy on a few general
concepts.

It's easy for me to create a child object from a parent object, like a
ship in space for example (not working with ships right now but seems
fun to talk about). I can then navigate the ship from the parent
object.

What happens if the ship's engine temperature reaches critical? Is it
wise to dispatch a ship event that tells space that my ship is nearly
scrap? Or do I periodically query the temperature amount of the ship
from space? To me an event sounds like the solution, but I remember
hearing somewhere that parent objects should only talk to child
objects, not the other way around. Is this true?

Could I trouble someone for a basic example of how you would make this
communication work best?

Thanks for the assist. I'll post if I find anything interesting in
the meantime.

How Do I Reference Objects Inside Of Exported Library Objects ?
Hi,

I am having trouble figuring out what seems to be a simple fix? I have created a movieClip in Flash that contains 3 button clips. I want all to be accessible to actionscript, so I gave the movieClip and the 3 buttons a Linkage Identifier. I deleted them from the stage.

In actionscript, I have instantiated the movieClip and, thankfully, the buttons inside went along.

The trouble I'm having is figuring out how to target those buttons. Since they're on the stage already, I shouldn't have to create a new instance right? When I trace the buttons I get an undefined return in the out put.

Anybody know this one??

Thanks for the help!

Brian

Depth And Dynamic Objects/Attaching Scripts To Objects
I am having some problems with my Flash MMORPG created in Actionscript 3.0 that I am working on, not really errors, but more how to do something, in theory. I have 2 problems. First, my game is at a 45 degree angle, so it requires some depth handling(like one object is over another object when it should be behind that object). I am not sure how to go about this. I was thinking that each object's depth should be it's y position if it's origin was at it's feet. But that idea didn't go well, because the depth is limited by the number of children. What is the average way to do this? Next, I am trying to make dynamic objects, so that all I would do is copy and paste an object, or create a new class of it and it would work. What I mean is, the character checks a collision for each object, but if I copy the object with the same name, it doesn't work. In AS3 you can't attach scripts to objects anymore, so I am running into a lot of problems with that. How would I go about fixing this? Thank you in advance.

Aligning Variable Sized Objects And Objects Inside Them
Hi,

How do I align a movieclip, which width and height is user-defined, inside another object (this one is static, though). Top-left alignment is easy, x=0 and y=0, but what about center, center left, bottom left, etc? Math(.round) i suppose, but how?

and

I want an object (static) inside the movieclip (user-defined) to stay aligned to, for instance, the top right corner, similiar to the minimize, maximize and close buttons at the top right of your browser..

The height and width data is pre-defined by the user in another file... But that does probably not make any difference...



If anyone could help me with this, I'd appreciate it alot!

Thanks!,
Peter

Best Way To Hide On Stage Objects When Other Objects Need To Be Shown?
A typical nubee question..What is the best way to hide objects on sage when a button from navigation is clicked and in response other information or objects need to be shown instead of the one previously on stage?

How To Output Both AS Objects And Drawn Objects On Pages?
Using Flash 8;

Hello,

I am building a site entirely in actionscript and the "shell" of the site, the pages, text, static images, come up and work fine, no problems.

However, I'm having troubles trying to implement Kirupa's "XML_Flash Photo Gallery", for one of my pages, link here:

http://www.kirupa.com/developer/mx20...otogallery.htm.

I'm running into troubles because my pages are entirely actionscript and this tutorial uses objects which were drawn by the drawing tool.

I have been trying to get both actionscript and drawn objects to work together and cannot get it right!!

Questions:

1) In terms of layering or frames, What is the best way to output on your pages both "objects drawn by the Flash drawing tools" and "actionscript objects"?

Is this better handled using frames or layers? Should I place my actionscript on the first few frames, then my "drawn objects" on the later frames? Or use layers and have my AS code above or below the manually drawn objects?

For example:

I have my actionscript on layer 1. Then use drawing tools to draw a box on layer 2.

When published, I want the "manually drawn box" and "the actionscript drawn objects" to both be viewable on the pages. Do I place the "drawn" layer above or below the

actionscript layer? Or should this be handled by frames?

I have tried both and neither seem to work for me. When I do one or the other, it works, meaning, all drawn objects, obviously things are viewable, then if

I use all actionscript, things are viewable, but when I try to combine both, the manually drawn objects do not show up.

The actionscript objects show up correctly, but I cannot see the objects I have directly drawn on-stage.

In my actionscript, I use, "_root.getNextHighestLevel()", for each of the objects, this works fine for all the actionscript objects. However, I did nothing

for the objects drawn using the tools, should I attach the same "_root.getNextHighestLevel()" to those objects drawn on-stage?


Or,


2) Should I try to draw Kirupa's objects on my pages using actionscript?

Thanks, any help is great!!

Dave.

Help: Stage Objects Get In Front Of Script Objects?
This is getting me mad...

addChild(my_script_object);

I can't see it...

If I try trace(numChildren) I get 10, so then I try addChildAt(my_script_object,9) and still cant' see it.

If I delete all the objects in stage then I finally see it.... If I delete one by one I find my_script_objects gets beneath a bitmap placed by hand by the designer.

Any ideas?

TIA

Best Way To Hide On Stage Objects When Other Objects Need To Be Shown?
A typical nubee question..What is the best way to hide objects on sage when a button from navigation is clicked and in response other information or objects need to be shown instead of the one previously on stage?

About Referencing Objects And Copying Objects
This is for AS1

hi,

i should know this but i got lost for a bit, can someone make this clear:

i have the following:

code: myobject=new Object()
myobject.var="hello"
getvar=myobject.var

In this case, get var has a reference for myobject.var, or it has just copied de value? mean if i update myobject.var to "good bye" get vatr will be that, too, or will stay as "hello".

If it's just a reference, how can make it a different variable, i mean, assign the value of myobject.var to getvar and loose any relationship between myobject.var and getvar, so if i update one, the other doesn't.

Anyone?

Problem With Class Objects Within Objects
Hi There,
I am having trouble creating an oop grid.
My initial object is "world" shown below which will contain an array of "Row" objects, which in turn contains an array of tile objects.
As i build up the rows and assign the tiles everything seems fine but when i try to retrieve the values the tiles in each row returns the same values from each tile..


class world{

//declare class members
private var goalScore
private var mapPreview
private var title
private var editor
private var createdBy
private var movieBorder
private var instructions
private var rows = new Array()

//Constructor
public function world(Param_goalScore, Param_mapPreview, Param_title, Param_editor, Param_createdBy, Param_movieBorder, Param_instructions){
this.goalScore = Param_goalScore
this.mapPreview = Param_mapPreview
this.title = Param_title
this.editor= Param_editor
this.createdBy= Param_createdBy
this.movieBorder= Param_movieBorder
this.instructions= Param_instructions
}

//Methods
public function createRow(){
if (rows==null){
this.rows[0] = new row()
}else{
this.rows[rows.length] = new row()
}
return this.rows[rows.length-1]
}

}
class row{

//declare class members
public var tiles = new Array()


//Constructor
public function row(){

}

//Methods
function createTile(Param_tileType, Param_completionScore, Param_objectType){
if (tiles==null){
trace("created first tile")
this.tiles[0] = new tile(Param_tileType, Param_completionScore, Param_objectType)
}else{
trace("created tile " + tiles.length +" tiles="+tiles)
this.tiles[this.tiles.length] = new tile(Param_tileType, Param_completionScore, Param_objectType)
}
return this.tiles[this.tiles.length-1]
}

}

class tile{

// declare class members
public var tileType;
public var completionScore;
public var objectType;
public var character;


// Constructor
public function tile(Param_tileType, Param_completionScore, Param_objectType){

tileType = Param_tileType;
completionScore = Param_completionScore;
objectType = Param_objectType;

//movementPreset = Param_movementPreset

//error = Param_error
//errorImage = Param_errorImage

}

// Methods

}

Any advice will be greatly received.

Jason

Mask Objects And Masked Objects
Well.. I don't know if there is already a thread on this subject, but I have this doubt, and I would really like some support.

Been trying to use one mask object to mask several movies, but it doesn't seems to work. Has anyone ever managed to do this?

For example:

Let's say I have three MC - man, woman and baby are their names - and I want to use setMask to mask then so they walk behind the walls of a house, but just show up through the window. I create, then, a mask object - one object with the shape of the window inside it - named it windowMask, put it in _root and added to my actions layer the following lines:

Code:
man.setMask(_root.windowMask);
woman.setMask(_root.windowMask);
baby.setMask(_root.windowMask);
Unfortunately, only the last of them - baby in this case - is masked.

Can't I use one mask object to mask multiple MCs?

Everything works fine if I duplicate the mask MC and set each copy as a mask for each of them.

Code:
man.setMask(_root.windowMask);
woman.setMask(_root.windowMask1);
baby.setMask(_root.windowMask2);
The thing is, what I wrote above is just an example. The real movie has 30 to 40 MC which should be masked by the same mask object and I don't want to have 30 to 40 mask objects dangling around my movie...

Mask Objects And Masked Objects
Well.. I don't know if there is already a thread on this subject, but I have this doubt, and I would really like some support.

Been trying to use one mask object to mask several movies, but it doesn't seems to work. Has anyone ever managed to do this?

For example:

Let's say I have three MC - man, woman and baby are their names - and I want to use setMask to mask then so they walk behind the walls of a house, but just show up through the window. I create, then, a mask object - one object with the shape of the window inside it - named it windowMask, put it in _root and added to my actions layer the following lines:

Code:
man.setMask(_root.windowMask);
woman.setMask(_root.windowMask);
baby.setMask(_root.windowMask);
Unfortunately, only the last of them - baby in this case - is masked.

Can't I use one mask object to mask multiple MCs?

Everything works fine if I duplicate the mask MC and set each copy as a mask for each of them.

Code:
man.setMask(_root.windowMask);
woman.setMask(_root.windowMask1);
baby.setMask(_root.windowMask2);
The thing is, what I wrote above is just an example. The real movie has 30 to 40 MC which should be masked by the same mask object and I don't want to have 30 to 40 mask objects dangling around my movie...

Making Objects Go Behind And In Front Other Objects
Say I wanted to tween something so that it like rotates around it.
IE: a moon rotating around a planet, an electron orbiting a nucleus

How would I make the orbiting object go in front and behind the stationary object?

AS3: XObject Class - Treat Objects Like XML (E4X4O - "E4X For Objects")
I just finished this a few minutes ago (coincidentally while at a SilverLight camp ). Its an AS3 Object that allows you to add "elements" in the form of objects much like you would with XML using E4X. By assigning values to an XObject, you are adding that value into its "node" structure as one of its children with the given name. Retrieving a property, instead of returning a value, returns an instance of XObjectList which is essentially a list of objects (like XMLList) that are defined to that property. As with XML, there is a separation of elements and attributes using the @ character to precede references. Without @ you access a child, with, you are accessing a property or attribute of that particular XObject or whatever object defined inside it. Setting an attribute of an XObjectList, assigns the value to that property of all the objects in the list.

Its a little hard to explain. Its better to just see some examples.


ActionScript Code:
var rootNode:XObject = new XObject();rootNode.one = new Object();rootNode.two = new Array();rootNode.two = 20;rootNode.two[1].deep = "Hello XObject";rootNode.@three = "attribute";trace(rootNode);/* output:<XObject three="attribute">    <Object:one />    <Array:two />    <int:two>        20        <String:deep>            Hello XObject        </String:deep>    </int:two></XObject>*/



ActionScript Code:
var rootNode:XObject = new XObject();rootNode.a = 1;rootNode.a = 2;rootNode.a = 3;delete rootNode.a[1];trace(rootNode);/* output:<XObject>    <int:a>        1    </int:a>    <int:a>        3    </int:a></XObject>*/



ActionScript Code:
var myMcs:XObject = new XObject();myMcs.badGuys = enemy1_mc; // movie clips on the screen...myMcs.badGuys = enemy2_mc;myMcs.badGuys = enemy3_mc;myMcs.badGuys.@x = 100; // all enemy mc's move to x = 100  


It's pretty much done, but there might still be some problems, so if anyone finds any, just say so. I'm not sure how many more methods I might want to add in addition to what's there now (to match XML) though I think I want to keep it as simple as possible, so probably not much more, if any, than what's already there. To see what's there now, you'd just have to check out the classes - its not much.

Treating Objects Like Objects....
Hey, I need a primer on how objects should be worked with in actionscript. I'm trying to pass along objects between functions like variables, which isn't working at all. Do I need to make a prototype function for each part of the object I want to manipulate? Do I need a reference movie clip in the library for any of it to work at all?

Basically, I'm trying to make do dynamic movie clip creation (each individually with special parameters) which will basically make different sized squares, then reference them later, by id, and still be able to get those parameters out of the mc. Anyone know what I'm getting at? Yea, it's for a game.

Basically, I'm need to have movie clips with information attached, and I need to be able to dynamically create them.

I feel like I've advanced from actionscript n00b to merely inept. Some help plz.... thanks in advance

GF

Objects Affecting Other Objects
I'm using flash MX, and i'm wondering how to make a Circle affect another one when it grows...

for example...

Lets say I have 2 circles next to each other... When I rollover a circle... I want it to grow... and when I roll off it... I want it to go back to normal size...

However, I want the Circle right next to it to move up or down... so when the circle grows... it doesn't cover the other circle...

I'm all outta idea on how to make this work right... Actionscript confuses me... but whenever I see it explained in a tutorial... I understand it...

If someone can point me in the direction of a tutorial... or is really good at explaining how to do things... I would appreciate the help

thanks

- Mikey

Blurring Objects OVER Objects
Hi
Ive seen animations where people actually have BLURRED frames IN ANIMATION ontop of other pictures [or other animations].. WITHOUT getting the white borders that your burdened with from the BITMAPS.

is there any program that you can do this with?
I dont want a reply that simply says "PHOTOSHOP" id like to know HOW in the program you do this.. I know there is the "soften edges" tool built right into flash. But this tool vastly slows down the animation PLUS: you cant "soften edges" with the pencil tool..

Thanks
-Lindsay

Accessing Objects Within Objects
Hey there,

What I'm trying to do is somehow assign the same class to a large number of movieclips within another movieclip. The nested mcs are already on stage in the positions that they need to be in. I need to go through all of the 200+ nested mcs and apply the same actions to them.

In AS2.0, I would loop through and do something like this...


Code:
for(var i in someObject){
if(typeof someObject[i] == "movieclip"){
someObject[i] = new objectClass();
}
}

What's an equivalent way of going about this? Any ideas?

Pushing Objects With Objects
I was wondering, how would I go about utilizing the drag script to cause the object I am currently dragging to push other objects. I know it has to do something with boundary lines, but I'm not sure. If you know how, or know where I can learn how, please do not hesitate.

(This thread was re-created (and the old one was deleted), since I hate double posting.)

Using XML Objects As References To Other XML Objects
Hello,

I'm trying to modify XML nodes in a XML list by reference,
in AS3, but for some reason Flash seems to be copying the node
value to it.

I need to change the reference so as to mimic a C/C++ pointer like behaviour.

This works with most flash objects I have tested, but not with the XML object.

Here's some code:

The below works:

var nodeList:XMLList= xmlObject.children();
nodeList[0] = <change>test</change>

Tracing the xmlObject, the value in nodeList[0] appropriately changes in the xmlObject variable


But what I want to do is this:

var nodeList:XMLList= xmlObject.children();
var myXMLNode:XML = nodeList[0];

myXMLNode = <change>test</change>

Tracing xmlObject, there seems to be no change to the object, however, the change is applied to the local variable myXMLNode

This works with other objects in flash like TextField, but does not work with the XML object.
Is there any known workaround or am I doing something wrong?

Thanks in advance

PHPObject, Objects Within Objects?
Hi guys,

I've built a php site already, but would like to add a flash component to it using the already established (or maybe slightly altered) php classes. The problem I'm finding is when I try to initialize an object that has another object within it. Example:

PHP Code:



class Test0 {

 function Test0() {
  //code
 }

}

class Test1 {

 function Test1() {
  $this->obj= new Test0();
 }






Now, when I try to create the object using PHPObject in flash, it results in a Connection Failure error. Everything up to an equivalent "$this->obj= new Test0();" line in my classes works fine. So I know its this object within an object idea. It seems like its trying to connect to the Gatway.php file again once it hits the nested Object. Does anyone know if this is possible in PHPObject? Any suggestions about how to work around it?

Thanks.

Selecting Objects Behind Objects
hey, in my movie i have MC1 on the root timeline and MC2 loads on top of MC1 however, i am able to mouse over buttons behind MC2? how can i stop this happening?

Sound Objects - How-to Preload Multiple Sound Objects
Im basically making a site for a sound engineer friend of mine, and like Im trying to make a music interface for his site, thats able to preload tracks, and play & load those multiple mp3 tracks dynamically (mp3s are in the same folder). Or the setup could be like multiple sound objects that have their own progress bar etc for loading kinda like the will-musser example. Im up for any suggestions as the MM docs dont help in this area very much

A good example of this would be @t http://www.willmusser.com. I under-stand how-to create and use 1 sound object for example, but when i try and use 2 sound objects etc, for 1 dynamic textfield named "progress", heres the coding to call-upon a sound object, which is basically 1 mp3 thats getting loaded, and shows progress in percentage via that dyamic textfield. What Im wondering, is if anyone knows of the AS for the btns to load tracks ie: on (release), load mp3"blaghla.mp3" ? if anyone knows the coding to load mp3s, feel free to leave a reply ;p And any good ways of calling upon multiple sound objects at once seperate dynamic textifelds or progress bars for loading etc.


PHP Code:




sound_1 = new Sound();
sound_1.loadSound("http://themakers.com/sounds/atmospheres_1.mp3", true);
function checkLoad(){
    var percentLoaded = (sound_1.getBytesLoaded()/sound_1.getBytesTotal())*100;
    progress.text = Math.round(percentLoaded)
    message.text = "MEK - Far From Home";
    
}
checkProgress = setInterval(checkLoad, 1000);

Properties Of .swf?
What is the naming convention used for grabbing properties from the .swf file!?
ex. I'm trying to find the height of the .swf or the x, y co-ords...just not sure what name to use for the .swf

Take Off All The Properties In A .swf?
I've been doing flash for over a year now, but I've never found out how to take off all the properties in a .swf. I've seen the allowscale = "false" or what not, but I know there's more. How do I make it so that when they right click on the stage, that it will only show "settings, about macromedia flash 6".

Thanks for all your help,
-Kac

Help~ Getting Properties
Hi there,

I need in getting the name of an movie-clip with in an movie-clip and put it into a variable name....

this is what i have...
(1) an movie-clip; call Cricle
(2) within the movie-clip, i have another 3 objects; Blue_color, Red_color, Yellow_color...

And by clicking on a button beside, i can change the color....
After changing the color how can i get the name of the movie-clip???

thankz in adv....
-----------
J3ff

Copyright © 2005-08 www.BigResource.com, All rights reserved