ActionScript 2.0 :: CS3 Unable To Insert Object Into Array?
May 4, 2009Code:
var userdataArray = new Array();
for (var s = 0; s<5; s++) {
[code].....
Code:
var userdataArray = new Array();
for (var s = 0; s<5; s++) {
[code].....
I'm trying to create object and insert them in an array, for moving them across the screen. I'm trying to use the attachMovie for this task:
attachMovie("MyObject",arrayVal[counter],1);
the problem is that the second parameter must come in "" like
attachMovie("MyObject","arrayVal[counter]",1);
So, as you can see, i'm not able to tell which number comes on the "counter" variable
arrayVal[0]
arrayVal[1]
...
and i'm not able to use it latter:
arrayVal[0]._x++;
...
How is this usually done? (i'm a as3 developer, so i'm stuck here)
I have a load of objects with arrays in them.
var tabData0: Object = new Object();
tabData0.tab1 = new Object();
tabData0.tab1.names = new Array();
[Code]....
I want to combine this output with a few more to refer to my object / array. The remoteHolder contains the value I need to know which object (tabData0, tabData1, etc) to retrieve the info from.
tabHolder['btn' + i].titleHolder.titleField.htmlText = all['tab' + tab].names[(i-1)];
But get this:
ReferenceError: Error #1069: Property tab1 not found on String and there is no default value.
i filled an array with some objects, i want to be able to call a random object from that array, for instance:i trace array[2] but i want the outcome to be random. Sort of like the shuffle function in PHP.
View 1 RepliesYesterday I made a nice little flash movie (a picture slideshow) and today I've looked a a few tutorials explaining how to add my new flash image. To keep it easy I made a single page, using Dreamweaver, just to display this one movie. Everytime I ruin in in dreamweaver (F12) nothing appears. Similarly, anytime I look in the properties and press play my flash image disappears.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[code]....
I am trying to insert child node in xml via actionscript as follow -
var xml:XML = <menu>
<item>burger</item>
<item>soda</item>
[Code]....
moreover it returns undefined and as described in actionscript livedocs -
If you call this method on an XML child that is not an element (text, attributes, comments, pi, and so on) undefined is returned.
does anyone know a good way of how to insert a number of string defined in an array?[code]msg error: "there's no property in with the name item".
View 3 RepliesI have a project that was dumped on my lap, and my knowledge of Actionscript is very limited.
The scenario is that the user is presented with a floormap of a building that should show a red dot denoting where each employee sits (based on X,Y coordinates on the floormap).
The employees' profiles (name, telephone, X/Y coordinates) are stored in a database.
One our our programmers managed to load the users into a Flash object array. Now, it's my turn to add some actionscript to place a red dot on the floormap for each and every user in that array based on their x/y coordinates.[code]...
so if my array is
ActionScript Code: var topScores:Array = new Array(1000,900,800,700,600,500,400,300,200,100)
I know that I can replace the item at position 5 by doing ActionScript Code: topScores[4]=550
but how do I just insert another array item without replacing so that position 5 becomes position 6 and position 5 is the new number?
more to the point, I then ideally want to lose the last postion so that the same number of items exists in the array
How would you insert sections of a string into an array?[code]...
View 0 RepliesI have 2 arrays and I want to create the third one as associative array.ex: tab1 contains IDtab1 (10,5,6,...) tab2 contains IDtab2 (12,12,12,5,5,6,10,10...)tab3 contains both IDtab1 and IDtab2 (associative array)However I want to able to insert into the right INDEX area only.
View 4 Repliesi see that theres the array.push and array.unshift, but thats just the beginning and the end of the array. how would i go about inserting an item(s) into an array at the desired index?
View 4 RepliesI'm trying to insert embeddable video code, such as youtube/viddler/etc.. which all start with the object tag:
<object width="480" height="385">
<param name="movie" value="[URL]">
</param><param name="allowFullScreen" value="true">
</param><param name="allowscriptaccess" value="always">
</param><embed src="[URL]" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385">
</embed></object>
into MySQL with PHP.
I'm trying to call it in php, but only get the text value back, basically, the entire embed code as text is displayed instead of the video itself. Here is my display code which shows text. How can I make it show the actual video instead?
<?php
//assuming a connection to the database exists
$sql = "SELECT * FROM table";
$result = mysql_query( $sql );
while( $row = mysql_fetch_array( $result, MYSQL_ASSOC ) ) {
$html = array(); //create an array of html formated values.
[Code] .....
The php code right above it pulls out this data, without the slashes and it displays the embed code perfectly as text, but the actual video does not form from that. Is there anyway to have the code displayed act as code and show the video instead of text?
how can I insert/add/push new values to specific place in Array?
For Example:
Array:
myArray["value1", "value4", "value5"]
[Code].....
How to insert movieclips currently in a holder in stage into array? Number of movieclips varies in each step.
View 1 RepliesI think that arrays are probably one of the more powerful tools available in flash,
mc with instance name but0
inside mc is a text box var name label , code is
[AS]label = _name;[/AS]
mc on main timeline code in frame 1 is:
subjects = new Array("page1","page2","page4","page4","page5")
butHeight = but0._height+5;
butNumber = subjects.length[code]....
What this code does is produce 5 buttons appearing one after the other, like a cascade effect, so far so good, I then want to insert the array elements into text box label, but all I get is subject, subject1, subject2 and so on.So, what do I need to do so that my buttons are called page1, page2 and so on.
how can I insert/add/push new values to specific place in Array?
For Example:
Array: myArray["value1", "value4", "value5"]
Data to insert: "value2", "value3"
So I need my array to look like this: myArray["value1", "value2", "value3", "value4", "value5"]
I am trying to loop through a list of images and then add them to list box with a itemRenderer
public function createDataProvider():ArrayList
{
var a:Array = new Array();
[code].....
When I insert my object into my scroll pane it does not center.
View 3 Repliesi have few button to let user click and the symbol will insert into the input text. i change my input box to 'symbol' but i facing the problem that i can't insert character other than symbol...
View 6 RepliesI am unable to get the length of the array.[code]...
View 3 RepliesI loaded multiple xml files inside Array now I am unable to use the xml files from array
Code:
function onLoaded(e:Event):void
{
var xml:XML = new XML(e.target.data);
[Code]....
How I can retrive data from XML files saved in array ??
I started to mess up with classes to see how they work, and I'm having some troubleI'm trying to do a class where the user gives an array, and a number. The result is a trace of random X numbers, according to the number the user requested. If he/she types 3, the class gives 3 numbers.It works nice, but when I try to put an sort(Array.NUMERIC), i get this error:
PHP Code:
TypeError: Error #1034: Type Coercion failed: cannot convert undefined to Function. at Array$/_sort() at
[code]....
What I'm trying to do is to create a class loading three images as a pile into a movie clip and be able to switch from one image to another (with a fade effect) thanks to a method (setPic).
The problem I have is when I want to store my loaded image into my array( magnitude[i-1] = loader.content; ) it doesn't load anything, provoking the addchild(magnitude[i-1]); to return a null error. I know the file is properly loaded because if I addchild(loader.content) directly it does load the image (but I can't store it and access it later obviously).[code]...
maybe someone can solve this one too:i have an array like this:
Code:
for(i=0; i<ap.length; i++)
{
[code].....
I'm new to flash and following a tutorial on how to make a small game. I've made some subtle changes, namely I imported .png's and made them into shapes and now am trying to move them. Here is the tutorial:
[Code]...
I am trying to learn xml in flash myself and am findingit v.hard.All i am trying to do is create a little 'story' with 3 pages.I have content loading into flash but I am unable to get the next 'sibling' into an array e.g. the title. I can only get page1's title in the array but I can never get to page 2.Here is my xml:
<maincontent>
<page1>
<title>Who is he</title>[code].....
This only traces the first title, how can i get to the second and the third so i can then display them in my text box?
i got a array which stores some elements, in string form, and these elements actually represent the name of the instances on the stage. now i want to trigger the instance to reset it's alpha value..
eg: i got an array["A"."B"."C"];Instances name available: A,B,C,D....Znow how i should do to make the instance A to got triggered?? i call them by using on button. i try some like _root.name.array[0]=_alpha=0; but not success.
I'm doing a flash game to go with this song on a band's website (sweet band, by the way (url...)), and the song would be playing during the game, and I want certain events to go with the beat of the song, and that would be so much easier if I could get a metronome on my flash project, and I'm running into problems with that.
I can't get an object to flash exactly 154 times every minute, because the song plays at a constant rate of 154 beats per minute. It's always a little bit off, so that after about 30 seconds, it ceases to be on beat. The object that I want to blink is called "blinker." Here is my actionscript:
Code:
var beatTimer = new Timer(60000/154); // A timer for how often I want it to appear (154 times every minute, or 154 times every 60,000 milliseconds)[code].......
I have a java socket server that sends an Animal object to the Flash client when it connects.[code]...
View 3 Replies