ActionScript 3.0 :: Simple But Head Twisting 2d Array ?
Dec 8, 2008
Im having a small problem with a 2d array Ive been coding for sometime now previous to actionscript Ive programmed in Java and Ive always accessed 2d array elements in the following way
Myarray[column][row]
Column before Row
X before Y
Width before Height
Im working on a project where I want to pre declare array elements something I haven't had the need to do before and Im using the following syntax to achieve this
var myarray:Array = [[0,1,0],
[1,1,1],
[0,0,0]];
Im writing it this way so that its clear how the information will be seen on screen as the 1's in the array will be converted to images the 0' denote a absence of an image.The problem Ive got is in order to access these elements I have to write Myarray[row][column] And I would much prefer to access it column first Myarray[column][row] as its what im used to and its too head banging to change over.Is there anyway to declare the array how i am doing now ie
c c c
var myarray:Array = [ r [0,1,0],
r [1,1,1],
r [0,0,0]];
And then twist the array something like this (note! not code syntax just a visual representation)
c c c
[0 [1 [0 r
1 1 1 r
0] 0] 0] r
Is there a method in as3 to achieve this or does anybody know of any short simple code to do it with
View 2 Replies
Similar Posts:
Aug 6, 2009
I'm getting the "Label must be a simple identifier" when trying to add to my arraywhy?
// var roundOne: set outside of function on main timeline
// var allRoundWinners:Array ; is declared outside of the function on main timeline
// both reside where all the code is created.. frame 1 -> layer "actions".
[code]....
View 3 Replies
Nov 23, 2010
I'm an AS2 convert and struggling. I can't figure out how to get my function to see my array. I keep getting an error that "i" is an undefined property.
var thingsToShrink:Array = new Array(
b1,
b2,
b3,
b4,
b5
);
function shrinkBars(myArray:Array){
for (i=0; i < (myArray.length); i++){
myArray[i]._yscale = 0;
}};
shrinkBars(thingsToShrink);
View 4 Replies
Mar 5, 2009
I currently use some code to break down a multidimensional array into a simple string like this:
Code:
var mapStr:String;
for ( var i:int=0; i < outArr.length; i++ ) {
for ( var j:int=0; j < outArr[i].length; j++ ) {
[Code]....
I want to be able to reconstruct the array from the string output from that.
View 1 Replies
Aug 8, 2009
I need to create an array inside a movieclip, so:
var Container:MovieClip = new Movieclip;
Then how do I make an array inside of the that movieclip. I've tried
Container.mCONTENT:Array = [];
But I get "Label must be a simple identifier"
View 4 Replies
Nov 24, 2010
making my image gallery, but it only works as each image in the array is clicked. Now I am trying to make the gallery move automatically to the next image in the array every 5 seconds while still giving the user the ability to click on an image to view the one that they want.Here is my code so far (like i said it works great, but only as a click-able gallery):
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.display.Sprite;
[code].....
View 1 Replies
Jan 24, 2008
a standard view and a "full screen" view...by default the standard view loads and there is a button to switch to full screen...when the standard view loads to begin with...the exhibitor list on the left works fine with the booths in the floorplan....meaning when you click an exhibitor, the corresponding booth lights up...however, when you load the second swf...which loads to _level0 using the following cose loadMovie("standard-0.48.xml", _level0); the exhibitor list does not work quite the same...when I click on an exhibitor now, the color for the whole floorplan changes, and does not change back...and if you click the standard view button, it goes back to the standard view, but again when you click an exhibitor, the color of the whole plan changes...any idea how to fix this?
View 3 Replies
Jun 9, 2010
I have movC_mc inside movB_mc inside movA_mc AS2 to access movC_mc from the my Actions layer in frame 1 in the root would be movA_mc.movB_mc.movC_ mc.My question is how can I target the movA_mc from the root of my .fla.[code]just can't get my head to transition from AS2 to AS3.
View 2 Replies
Feb 17, 2010
I don't really know how to describe this problem but I'm going to give it a try. I am working in Flash cs3 using as3. I have a project with 5 scenes and button nav to jump between them. When I test the project scene 1-4 play fine however when I get to scene 5 the playback head doesn't move, it just stays parked on frame 1 (button nav works, animation does not). When I re-arrange the stacking order of my scenes the same problem will occur in a different scene that had previously played fine. This issue only occurs when i test the whole movie - if I test any scene by itself it plays fine. I am not getting any AS errors which adds to the frustration
View 7 Replies
Mar 5, 2011
As I use play(); in a button-script to send the timeline head forward in my mc animation, which is the simplest way to tell another button to send the head backwards?
View 5 Replies
Mar 21, 2009
There's a lot of talk of how the new Event Flow makes for easier communication between classes.This sounds swell,but nowhere is it properly explained. Every example I find concerns dispatching events within the same class or looped through a customEvent, but I need a way to tap into this Event Flow for backward communication.I have a mainGUI document class that distributes my application subclasses.How do I set up a listener within mainGUI that gathers certain events from any of its children or grand-children? And how can I use this line to post object properties?
View 1 Replies
Feb 10, 2005
I'm using Flash MX (2002) and I need to get my variable values saved to a server each time my test subjects run and finish my swf/fla (PHP scripts and a .txt file on the server are being worked on, but that's a different nightmare!). I'm pretty sure I should use LoadVars, NOT SharedObject for this data capture right?. The data must not be overwritten each time over the course of a few months of data collection.
The 3 variables are: username (name of the user), counter (this keeps track of which version the user chooses from the start menu), numcorrect (keeps track of the number of times the <right> arrow key is pressed).
I don't know where to put in the LoadVars obj (in the AS code of "finaldisplay" frame?) AND I don't know how to build/format the LoadVars object to capture the data in the 3 variables I listed above.
View 2 Replies
Feb 28, 2006
find out where the play head is?
I'm trying to do something like this
Code:
if(_root.movie.currentPlayHeadPosition == 1) doSomething();
Its been a long time since I last did any flash, can anyone jog my memory on how to get the current frame?
View 1 Replies
Sep 12, 2003
I want "rain drops" to fall randomly and then when they hit the bottom most pixel of my stage to run another movie clip called "splash" so it looks like it is raining and the "drops" could fall and "splash" at the bottom of the stage.
View 9 Replies
Dec 10, 2003
how will be actionScript for waiting the play head in a frame for 5 second ?
View 5 Replies
Jun 23, 2009
I am using flash CS4 and ActionScript 3.0 i have a movie clip on stage that i have close when the user hits a button how to i also tell the maine time line to go to a frame when this button in the Movie clip is pressed?
View 2 Replies
Dec 18, 2011
By far the weirdest thing I've ever seen. On some machines (!) IE (!!) attempts to load an SWF file via HEAD request instead of GET. This happens only when the page is running in Facebook IFRAME application - when running solo works fine. Naturally, on FF and Chrome everything works just fine. The SWF is embedded using jSWFObject. There's no visible common feature to the machines which experience this problem - laptops, desktops, XP, Vista, 7.
View 1 Replies
Aug 29, 2011
I would like to construct a RegExp/Actionscript3 statement/routine that will do the following:
1. Locate the link containing the favicon. Note that there can be many <link>s in the <head> so I am looking for the one that specifically includes the : <link rel="shortcut icon" ...favicon.ico">,
2. Most favicons are in the ".ico" format, but I have seen favicons that are .png and .gif formats. The next step is to save the .ico in a .png format
View 2 Replies
May 28, 2005
I'm trying to wrap my head around writing .as files in MX 2004. As a practice file I made a MovieClip called SquareClip in the library of flash file. I made the linkage name SquareClip. My .as file called Square looks like this:
[Code]...
View 1 Replies
Jun 11, 2007
Been creating a scroll bar for images. the issue is i cant seem to get sensible stop parameters for the ends of the scroll and scroll bar button. my formulae just wont tie in with the positions at extreme left and right of content/button movement.
The number of images scrolled in the scroller is set by a txt file and is currently at 16, but this is to be changeable. that bit is not an issue, just the scroll parameters. Oh and the Images are in an "images" folder - surprisingly!
[Code]...
View 1 Replies
Dec 29, 2007
I make a flash movie. I want to create a progress bar with custom play head that when we drag it, the swf file will adjust appropriate position, similar to the progress bar in comman media players. My main swf file has about 2000 frames
View 2 Replies
Feb 17, 2009
I am trying to create a character whose head will follow the mouse. I have made a character whose eyes are following the mouse, but I would like the head to turn with the mouse as well - like the cyber pets here.
View 3 Replies
Apr 22, 2009
var mySound:Sound = new Sound();
mySound.loadSound("http://192.168.0.121/work/vivek_php/fatima/myFavSong.mp3");
mySound.setVolume(20);
trace(mySound.id3);
mySound.start();
trace(mySound.position);
View 1 Replies
Mar 23, 2005
I'm trying to make this script work in which two things should happen onRlease of a movie clip. The "transition" plays but frame 18 doesn't..even though the path is right. I even tried frame label even that doesn't work.I must be doing something wrong, maybe you can detect from this script. The script is on the clip itself.[code]
View 7 Replies
Mar 24, 2009
would like flash to trace something when the play head goes over a frame label named "test" I would also like to have the code placed on the first key frame. I realize that the easiest way out would be to place the trace statement on the frame with the label on it but I'm trying to run this with a listener.
PHP Code:
stage.addEventListener(Event.ENTER_FRAME, checkFrame,false,0,true);
function checkFrame(event:Event):void
[code]....
View 2 Replies
Jan 17, 2007
anyone can offer me a way of housing an XML return in a seperate object, so that the flash movie in question doesn't hang around waiting for the feed to come back.The problem is we have an asp app which is returning the status of about 1000 citrix terminals at once.... while this only takes 10-15 seconds to return, any kind of animated loader i build into the movie, stops playing while flash holds on the XML return, as the http response status never responds dead, but says "waiting" instead.Any kind of way of adding the XML load script as an object listener maybe...?
View 3 Replies
Nov 8, 2010
I am trying to acomplish a very simple task with AS 3 with no results. I have a simple time line with a stop button. All I want to do is to stop the play head wherever the viewer clicks the button, and then to start again from there when the button is clicked again.
View 4 Replies
Feb 19, 2010
I'm wanting to use a button in flash to call a javascript function that resides in my main html page.I think this can be done, but I'm not sure how to do it?
View 1 Replies
Jun 27, 2007
The movie clip is called "theScene" and I have it created on Frame 60 of a movie clip when a button triggers the playhead to jump and stop at Frame 60. However, upon leaving that frame, it will not disappear, so I want to unload it upon leaving that frame.I put in the following code across all frames of the movie clip in its own layer:
Code:
if (this._currentframe !=60)
{
[code]....
View 3 Replies
Mar 3, 2012
So I am able to dispatch the event from one class and trace out that the custom event was dispatched, but where I am having trouble is listening for that event in another class.
[Code]...
View 14 Replies