Ask a Question related to Macromedia Flash Actionscript, Design and Development.
-
Pea #1
Array problem in custom class
Hi all,
I have a (complex) problem with arrays (or perhaps the object itself) in
custom objects loaded from an external swf file. Has anyone ever seen the
following (this is just an example):
I have a clip 'lib' that contains many library objects as swf files 'square',
'triangle' and 'circle' which are set to export for actionscript with the same
name. Each library object has an instance inside it of a custom object which I
will call 'shape_properties', which has an array as one of its properties to
store the length of each side. so lib.square.shape_properties.sides is an
array. There are NO objects on the stage of the lib clip.
The first frame of each clip in 'lib' (like 'square', 'triangle' etc) is like
so:
// First frame of square
this.shape_properties = new classes.shape_property();
shape_properties.push(20,20,20,20);
stop();
// First frame of triangle
this.shape_properties = new classes.shape_property();
shape_properties.push(30,40,30);
stop();
The problem occurs when clip 'lib' is loaded in to another clip (A is a
placeholder):
_root.A.loadMovie('lib.swf');
Now when I use attachMovie to create shapes like this:
_root.A.attachMovie('triangle','newTriangle',100);
_root.A.attachMovie('square','newSquare',101);
And then do a
trace(A.newSquare.shape_properties.sides);
The trace shows that the newSquare.shape_properties.sides array also has the
values of the sides array for the triangle, and visa versa.i.e:
30,40,30,20,20,20,20
Has anybody ever seen this before? I have made sure that the shpae_properties
object is local to each clip in lib, and when I place a square and triangle on
the stage of 'lib' they are fine.
Cheers,
Peter
Pea Guest
-
Pending Class onResult in custom class.
Ok, I have a custom class with private field: private var test:Stringint the constructor I load the web service: pws = new... -
Actionscript: Custom class function call problem
Hello, In short, is it possible to create a custom class with a data structure and a couple of functions that can be later referred to after being... -
How to control the root name with which an array of a custom class objects are serialized????
Hello, is there a way of controlling the name with which an array of objects of a custom class is serialized??? public class MyClass {... -
Array Problem with custom classes
I have tried to store instances of a custom class in an array. When I retrieve the object actionScript seems to have forgotten what type of object... -
Problem with Custom Class
Hi, I'm having some problems using a simple custom class I've created, maybe somebody can help me out. Here is the class definition I've created:...



Reply With Quote

