Well, I got Flash and Processing talking from within AS files (make a separate Actionscript Class file with all the code in it, and name it the name of your class; your main Flash file will have no “actions” but instead be of the same document type as the AS file; it’s much neater). It took a while (I ran into tons of errors and eventually winnowed my code down to one file to avoid static type errors), and I still need to get the masking property to work, but all in all I’m pleased with myself for figuring out all of the errors!
Classy, yet complicated
24 02 2010Comments : Leave a Comment »
Tags: actionscript 3.0, classes, error, flash, success, troubleshooting
Categories : Uncategorized
Ask me what I should be reading…
20 02 2010Yesterday, John helped me get the socket to work in ActionScript 3.0, which should make drawing much easier… I say “should” because I have yet to draw circles from within a loop successfully, and because I need to make sure my string sorting algorithm is working properly. I’m going to do a test by sending it obvious data (i.e. x-val-1, y-val-1, r-val-1, x-val-2, y-val-2, r-val-2, et cetera) and then checking the contents of the string and the sorted arrays. More work on that to come today.
In other news, I enjoyed the sun yesterday: I biked to 5th St Market for falafel and lamb curry at Casablanca, my favorite eats in town, followed by espresso ice cream at Marche Provisions downstairs; then back to campus for my honors science class, which turned out to be very entertaining (among the topics tangentially discussed were floating cities on Venus and relocation of all Republicans to Mars, to which I replied that was littering and we should send them to a penal colony on Venus; note to all Republicans: peace out, I love you, it was all in good fun, I assure you!). Then I biked out to VRC to see Sherlock Holmes (with my sneaked-in Wetzel Pretzel and Naked bottle full of water, plus the macaroon from Marche Provisions), which proved to be very entertaining (I love explosions and intrigue, plus ROBERT DOWNEY JUNIOR! oh, dare I hope for a sequel?), and then biked back in the relative dark, ignored dinner until 10 or so, and caught myself up on the Men’s single skating (I still think that Johnny Weir was heinously underscored and should have taken bronze at minimum, if not silver; Plushenko’s jumps were just not there—tilts and wobbles and I don’t know how he managed to land one of them, added to choreography that just wasn’t all that great). Sigh. I felt so bad for Takahashi falling on that first jump, but he pulled everything else off spectacularly.
I’m almost done with Forty Thousand in Gehenna, by Cherryh again (finished Cyteen: the Vindication some time earlier this week), which has been brilliant. Go ahead, ask me what I should be reading…
UPDATE: I resolved the array data sorting issues and got Flash to draw from within the loop (yay! but not quite how it should be drawing… compare the two here). And Flash is crashing again, a scurrilous action I thwart by reflexively saving before I run the thing. I’ve put a 5-second delay into Processing (better than the 1-second delay it’s been for a while) and I intend to figure out how to debug with breakpoints in Flash.
UPDATE: Hmm…
Well, fine, Debugger! Be that way! Guess we’ll have to do this the hard way.
UPDATE: Flash has stopped crashing, and the circles are in their proper positions, but the radii are wrong, and the stage is not clearing appreciably. I think I should start drawing the squares as child sprites so I can delete them as necessary, but the example code in the AS3 API has errors (Packages cannot be nested), which strikes me as funny even as it annoys me.
Comments : Leave a Comment »
Tags: actionscript 3.0, biking, c.j. cherryh, debug, error, movie, Olympics, other news, parent-child, progress, reading, sneaking, sprite, success, sunshine
Categories : Uncategorized
ActionScript 3.0 XMLSockets are a pain…
17 02 2010You can find my code from today here, and yesterday’s here. Compared to the ease of making Processing talk to Flash in AS2.0, AS3.0 is a nasty, hairy spider with knives for legs sitting on my laptop. Laughing at me. Seriously, I keep getting error after error, the most recent (and most confusing) one is:
Why can’t it find the split() function?! (The split function allows me to take my string of “1,1,7.83457,1,2,8.34985,1,3,7.68472″ et cetera and easily separate it into the sensible pieces from which it’s made, namely: {integer, integer, long float decimal value} repeated 850 times for each point on my Processing video feed.) And I don’t know what’s up with the “no default value.” Grr. I really, REALLY don’t want to have to draw my circles in AS2, but if I can’t figure this out, I may have to.
WHY?! I will go get my peanut butter and other essential groceries and look at this again upon my return. X(
UPDATE: Several hours and crashes later (luckily I save before running anything)… I’ve given up on AS3.o for the moment, and am attempting to draw circles in AS2.o via a method that is pretty clean. So far, I have a curious set of densely compacted concentric circles that meander back and forth across the stage in no pattern I can discern, but correctly in time with the socket data Processing is sending (every second, via the delay function). I think I need to figure out how to determine the stage size (I’m using the createEmptyMovieClip(String name, int level) method. The function below is the one I’m working on at present, trying to use the data from the socket (correctly sorted into rArray, xArray, and yArray, each an array of radii, x-coordinates, and y-coordinates) to draw the corresponding circles that my Processing sketch gives me. See Processing Circles and Flash Circles.
function drawMask() {
this.createEmptyMovieClip(“clip”,0);
with(_root.clip) {
.beginFill(0×000000);
for(i=0; i<rArray.length; i++) {
drawCircle(rArray[i], xArray[i], yArray[i]); //radius, x, y
trace(“circle drawing works!”);
}
endFill();
}
}
Comments : Leave a Comment »
Tags: actionscript 2.0, actionscript 3.0, code, error, frustration, troubleshooting
Categories : Uncategorized
