Hello,
I am studying the behaviour of filaments in a fluid where the filament is approximated by a number of interconnected beads. For eacht timestep I got a text file containing coordinates from the simulating c-program. What I want to do now is visualize it using flash+AS3. I want to use AS3 to read coordinate datafiles I have, and to use these coordinates to create an animation in flash.
This is what I have, although I get a 'type error' when I run it.
I define my multidimensional coordinate arrays and the URLLoader.TypeError: Error #1010: A term is undefined and has no properties.
at display_fla::MainTimeline/frame1()
I push the one dimensional array onto my multidimensional array.Code:var loader:URLLoader = new URLLoader(); var xpos:Array = new Array(); var ypos:Array = new Array();
Here I call the loading function for each file I have (in this case onle test0.txt and test1.txt, later there will be much more).Code:loader.dataFormat = URLLoaderDataFormat.VARIABLES; loader.addEventListener(Event.COMPLETE, loading); function loading (event:Event):void { xpos.push(loader.data.xpositions.split(",")); ypos.push(loader.data.ypositions.split(",")); }
So far I think I have created two multidimensional arrays, one for x versus the timestep and one for y versus the time step. Now I want to add MovieClips (of the bead) and move them around the screen according to the coordinate arrays.Code:for (var j:Number = 0; j < 2; j++){ loader.load(new URLRequest("test"+j+".txt")); }
I make an array of movieclips (for testing I had restricted to just 10 beads)
In this loop I intend to continuously change the positions of the beads on screen to create an animation, however, it's not working yet.Code:var bead_:Array = new Array(); //add enough beads for (var n:Number = 0; n < 10; n++) { bead_[n] = new bead(); addChild(bead_[n]); }
Thanks for any help!Code://move around for (var k:Number = 0; k < 2; k++){ for (var i:Number = 0; i < 3; i++) { bead_[i].x = xpos[k][i]; bead_[i].y = ypos[k][i]; } }![]()




Reply With Quote