ActionScript 3.0 :: Array Displays Value From Another Class
Sep 4, 2009
I am in the midts of this application, and it seems as when i pass in an array into a class, and try to place the same object in a diffrent context on the stage. It remembers the settings of that object from the previous class, even though i assign it as a new instance. Talking about Loader
the array looks like this
_meta:Array = {category: loader_object};
My document class
_firstview = new FirstView();
_firstview.object = _meta[0].category; //This is placed through an access modifier
_secondview = new SecondView();
_secondview.object = _meta[0].category;
[Code]....
The object from the first screen now disappears and it shows up on the second screen, but it should appear on both screens
I tried to copy the array and the object, instantiated new Loader object, but it is still giving me the same results
why there would be this glich, how can an object not be copied properly, if it is stored in private variables within the class
I tried:
_meta.concat();
_copyArray = _meta;
View 7 Replies
Similar Posts:
Nov 16, 2005
I have a page that loads in links from an XML into an Array and displays them. When you rollover each link it is supposed to turn red. My problem is that I can only get it to make the last link to turn red. Also, when you rollover any other link the last one turns red. I need a way to set up a variable for each link. I have attached the files so you can see what I mean.
View 3 Replies
Apr 26, 2010
why i keep getting Parameter child must be non-null. And my code won't display 5 enemyBlock objects onto the stage but only just one.
returns:
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChild()
at flash.display::Stage/addChild()
[Code]....
View 2 Replies
Feb 17, 2009
I've hit a brick wall here. I have a Flash file that displays fine in IE. It also displays fine when ran as a SWF. However, in FireFox, it does not display my scroller. I developed the Scroller component dynamically... everything is drawn from scratch, no library movieClips, etc. I'm starting to think that could be the cause? I've tried many different things:
[Code]...
View 5 Replies
Feb 15, 2009
I've hit a brick wall here. I have a Flash file that displays fine in IE. It also displays fine when ran as a SWF. However, in FireFox, it does not display my scroller. I developed the Scroller component dynamically... everything is drawn from scratch, no library movieClips, etc. I'm starting to think that could be the cause? I've tried many different things: Changed the HTML code to bare bones embedding code.Recompiled in Flex.... same result!Tested on another computer... it worked fine! However, I tested on another computer with FireFox... same problem.
It's so weird.I seperated the Image Slide show component from the Scroller... the scroller had the same effect... didn't display in FF.Played around with WmodeChecked my code for addChild problems, visibilty, alpha properties... nothing out of the ordinary.Asked God.Drank some Gin.Took a break and came back to it.I've reseached Google and the most I could come up with is to compile using FP10. It is FP10. I'm using CS3 and FlashDevelop. When I right click on my Flash file, it does indeed display FP10. Same with Flex.
[Code]...
View 6 Replies
Apr 5, 2011
I have a class file that displays a slideshow and preloads each image in an xml file. the code is below. What I want to know is, is there any way to improve this code?
Code:
package {
import flash.display.MovieClip;
import flash.net.URLLoader;
[Code].....
View 1 Replies
Oct 13, 2010
I'm trying to call a function in one class from another class and I'm using an array in the function of the class that I am calling from the other class. The array is declared and instantiated in the one class but when the other class calls the function with the array in it I get an error #1010: A term is undefined and has no properties. because the class that is calling the function that contains the array doesn't know that it is already declared. Anyway here is the code.
//CLASS THAT CALLS THE FUNCTION OF THE OTHER CLASS WITH THE ARRAY:
public class SpaceWolf extends MovieClip
{
private var _playerMissiles:PlayerMissiles;
[Code].....
View 7 Replies
Nov 25, 2009
I have a function:
PHP Code:
function getInfo (){
cardDetails= new Array('v','a','r','i','o','u','s');
var parent_mc:CatProcess = CatProcess(this.parent);
parent_mc.addForm(parent_mc.finalCardScreen,cardDetails);
parent_mc.removeChild(this);
}
this accesses a function of the parent movie clip - addForm which is:
[Code]...
This then adds an instance of the class finalCardScreen before removing itself. I want to be able to pass cardDetails array through to the new screen. I don't know what to put in my addForm object to do this though because I don't want to do anything with it just now, just pass it through to the class that is being attached.
View 2 Replies
Nov 5, 2009
I built a class that parses JSON data, stores it in an array, and now I want to return that data so that it can be stores in an array in my root AS file. I'm eventually trying to pass the returned array to another class. My class looks like this:
package com.src
{
import flash.display.Sprite;
import flash.net.URLRequest;
[Code]....
I keep getting the following error however:
1061: Call to a possibly undefined method payload through a reference with static type com.src.DataGrab.
Does anyone have advice on what might be wrong with my class, or a more logical way to write the getResults() function so that I can get retrieve the array being generated by this class?
View 2 Replies
Feb 3, 2011
I have a class consisting of a nested array called twoDArray.
public class TestArray
{
public function TestArray() {
var twoDArray:Array = new Array(new Array("one","two"), new Array("three", "four"));
}
[Code]...
I thought I would be able to reference OrbArray for example using trace(OrbArray[0][0]); giving me the output I am looking for of "one". When I attempt this I get ReferenceError: Error #1069: Property 0 not found on com.orbclasses.TestArray and there is no default value.
View 2 Replies
Feb 27, 2011
I have a class that controls an enemy. From within that class, it checks for collisions with an array on the main timeline. I've done it this way before and it works fine, so I have no idea what I've done wrong this time. It keeps giving me an
[Code]...
View 2 Replies
Aug 17, 2011
I was wondering if it was possible to create an array of classes in Flash. Is it possible to do like in C++ where you can do the following?
CDog dog[100];
for ( int i = 0; i < 100; i++ ) {
dog[i] = new Dog();
[code].....
View 1 Replies
Aug 29, 2011
I am new and having an issue with the use of classes in as3. I have created an array of objects in my main timeline
[Code]...
View 1 Replies
Apr 29, 2010
[code]The compiler is throwing 3 errors of the same type 1119(1119: Access of possibly undefined property enemyList through a reference with static type Class.) and pointing to the 3 places where I used enemyList in the Hero class. Why cant I use the static array in the Hero class? Or is there another method to detect collision through the available enemies on screen?
View 3 Replies
Nov 20, 2010
i'm trying to get out an array from a function in a class.
private function loadData():void{
trace(xml); This is ok xml have a value
for each (var item:XML in xml.items.item)
{
[code]....
View 3 Replies
Jan 31, 2008
Instead of asking how to do it, or whether there's one I can use, I have written this class,and would like to share it with whoever is looking for something like that.You pass the path to the xml, it loads it, parses it into an array, and fires it back in an event.
View 7 Replies
May 26, 2010
To call a class we would type: var testClass = new TestClass();Can I store the class in an array, and somehow pull it when I want to call it the same way? I need to be able to call a new class like the example above, but from an array.
View 3 Replies
Oct 8, 2010
I cannot display any SVG image in my Internet Explorer. I recently installed the Adobe SVG plugin without success.
View 1 Replies
Mar 10, 2010
I created a flash file on my PC and exported it. When I view it online with my PC, it looks perfect...but when I look at it on a MAC, the font type is different than what it should be. I tryed different browsers on the MAC and it still displays the wrong font.
View 1 Replies
May 5, 2010
I have a multidimensional array on the main timeline. Its name is myInst. I need to access this array from this class to build a scrolling list of swfs which the path to the swfs is in the myInst array. I have not included the entire code/class because the issue is somewhere in this part. The error is 1009, cannot access a property or method of a null object reference. This fla is not going to be the root fla, it is going to be external, so the use of root probably will not work, but I tried it anyway, to no avail.. for any help.
package {
import flash.display.MovieClip;
import flash.net.*;
import flash.events.Event;
[code]....
View 6 Replies
Feb 27, 2010
i retrieve a list of instances located in a array to manipulate them in a variable holder. Normally, the operations can be made between two instances stored in a simple variable to variable fashion and it works realy fast.I analysed two main operations: retrieving references in a array to a variable and get or set a value from the variable reference.Here are the objects used to perform the test operation:
var v4:Vector.<Person>= new Vector.<Person>();//List of Persons instance
var refHolder:Person; //Typed referencevar refHolder2:*; //Not typed reference
Test #1: looping 200 000 times and only retrieving references from the array v4.[code]........
So my conclusion with that test is that with a typed reference you spend more time assigning a reference than manipulating a value from the reference With a not typed reference, the time spent is in manipulating the reference in the variable.Which one should i use or what should i do to have better performance with manipulating references from arrays?
Here are the files i used to test this:
reference.swf //Online example
reference.zip //Source file
View 6 Replies
Jun 7, 2011
I was wondering if it is possible to access an array from outside the class where it's made.I have a main class, Aardbeleving, which AddsChilds to the stage, with class Eiland.Inside Aardbeleving i use an array to store data for all the childs, called: chip1.Now lets say I want to access chip1[2] from the Eiland class, how do I do that?
View 17 Replies
Aug 5, 2011
Is there a way to add the unit what gets attached to the array as unit4 and has an instance of unit4 and then if u press it again as unit5 with instance of unit5 and so on. This is my array.
var unitA:Array=[unit,unit1,unit2];
var unit = 0;
function addunit() {
if (cash>=50) {
var unit = attachMovie("unit", "unit"+units, _level0.getNextHighestDepth(), {_x:100, _y:100});
unit += 1;
cash -= 140;
}} unit_btn.onRelease = addunit;
View 7 Replies
Jan 16, 2010
I'm trying to create a class that contains an array. However i want to require that the items in the array are themselves of a specific class. Im told there is some sort of tag you can add to do this, but for the life of me i cannot find what it is.What i hope for is something like:
public class myClass{
public var foo:String;
[ArrayType(class="BarClass")]
[code]........
View 1 Replies
Jan 25, 2011
If my main class I define
var arrItems:Array=[];
and in a utility class (in a different file) I define
[Code]...
View 4 Replies
Mar 16, 2011
I have an array in a timeline that I need to pass to a class file, but I can't seem to figure out how to do this, as the method of inter-class array transfers doesn't seem to work.
View 1 Replies
May 22, 2011
Assume I have the myCircle class all defined and all that. If my code is as follows:
[Code]...
How would I write a function to return an array of [circle1, circle 2, circle3, circle4] automatically?
View 2 Replies
Sep 19, 2011
I want to sort an array collection in a way that I am not sure is possible.Usually when you want to sort you have something like this.[code]if a is the same in multiple classes then I want to sort on ToSortInner2.aa Is this possible. I have tried to pass in inner1.aa as the sort field name but this does not work.
View 2 Replies
Nov 4, 2009
Ive got two classes and my stage. I'm trying to use an array to keep control of my enemy class's number for collision purposes and I managed to get the enemies to populate the array.
View 3 Replies
Aug 18, 2010
I have an array of a custom class. The class includes 3 movieclips that all share the same position. I have 5 items in the array, and in the document constructor I fill them as such:
ActionScript Code:
glassArray[0] = new glasses(spot, beam1, glasses2, "index/nav/aboutus", new Point(156, 400));(different string and point for each of the 5 items)
Here's the glasses constructor:
ActionScript Code:
public class glasses extends MovieClip{ //I am the Constructor.
public var spot:MovieClip;
public var beam:MovieClip;
public var glass:MovieClip;
protected var target:String;
[Code] .....
It then goes on to fill each of those mclips with properties based on the point received. How to addchild from the class, I've got a simple for loop in the document constructor that adds them all in. Everything works, except what I'm seeing is that as each item in the array is added in, it overwrites the previous items' properties. In effect, I can create 5 items and give them each a different position, but when I go to addChild I see that all of them have taken on the position of the 5th one.!
View 2 Replies