[flexcoders] Re: Programmatically create MovieClip frames?
Thanks Jason, Troy, and Paul, for all your help/feedback. Jason, I can't think of a use case for adding frames to a MovieClip either. Unless of course, you wanted to have animations that you could control with AS3, but didn't have access to the Flash CS3 preview. Though, now that I think about it, it seems like there are some interesting possibilities for dynamically generated animations. Imagine a 'community' site that invited users to create their own animated avatars... or a video game in which the player designs his or her own character... or collaborative animation project in which different artists are creating different parts, maybe even individual frames of an animated sequence... or where a lead animator is creating the key frames, and 'tweeners' are creating the in between frames... you could even track and control this CVS-like, without having to pass around/merge FLAs. Maybe these are pretty abstract, I know... I thought of them just now. The point is, I personally don't WANT to add frames to a MovieClip. But I don't have access to the Flash CS3 preview, and so I was wondering if it was possible to generate AS3/AVM2 MovieClips, in some other way. MovieClip.appendFrame() seems like it'd be easier than the method Troy describes of creating a custom AnimatedSprite class, which will eventually have all or most of the methods of a MovieClip... at least, the timeline control methods. Basically, if I were having this problem 20 days from now... I wouldn't be having this problem. You're right, I'd just make the MovieClips in Flash CS3, export the library into a SWC, and use them from there in my Flex app as I wanted. That would definately be the easiest way. Luckily, I foresaw this problem pretty early on in the project, so I have plenty of time to work on other things while I figure out the best way to handle this... maybe the other things will even take me until the end of April and I won't have this problem at all. In anycase, I appreciate all your help, and offers to help. If it turns out that I need someone to make me a SWF with a few blank frames somewhere down the line, I'll definately be hitting one of you guys up for that. Other than that, I think we can call this discussion closed. Unless someone has more information about it. Although, and maybe this is a seperate post/question in itself, I thought I once heard about being able to control/communicate with AVM1Movies once the new version of Flash came out... I guess that's not happening? NO DYNAMICALLY ADDING FRAMES TO MOVIE CLIPS!! Got it. Thanks all, //Matt --- In flexcoders@yahoogroups.com, Troy Gilbert [EMAIL PROTECTED] wrote: Okay, how about the simple scenario where you want the playback of a series of frames of animation... you know, exactly what a movie clip does? I could definitely do this by creating a class that extends sprite and in that class keeping an array of shapes (or sprites) and each ENTER_FRAME event moving my virtual playhead forward to the next sprite, etc., etc... And you know what I'd get? A MovieClip! Looks like Adobe already wrote that one! ;-) Seriously, though, the problem is not that you can't programmatically edit a MovieClip, it's that Adobe's docs don't make it clear why you wouldn't want to do that... because the MovieClip is a much more complicated beast that stores tween details, etc., that aren't exposed in the API (details you'd be familiar with if you've ever attempt to generate SWF's from scratch in an open-source tool like I did back in the Flash 4 days). The docs describe MovieClips as basically sprites with timelines... which would lead one to think, hey, sprite is great, but I need a timeline 'cause I got some animation, so I must need a MovieClip! I know this because I went down the same route. What I ended up doing was basically creating an AnimatedSprite class... it has a currentFrame property, and list of frames (which, in my case, are BitmapData's). Each frame it increments currentFrame and updates its display list to include the appropriate bitmapData. Pretty simple stuff... So, to address the original poster: MovieClip is just a mirage! Think of it like its got a scarier name like CompiledSWF and treat it like a blackbox. It'll make your life easier. Troy. On 3/29/07, Merrill, Jason [EMAIL PROTECTED] wrote: Matt, So Paul and I discussed our pointless bickering offlist and hugged it out. We're good now. Both of us however were just wondering about this question you have (me, so I could you, him for academic reasons) since we ironically agreed offlist neither of us could figure a good use case for needing do do this. Maybe you can explain in more detail what you will do with these frames once they are inserted. But really, we probably should move this to a Flashcoding list like Flashcoders. Jason Merrill Bank of America GTO Learning Leadership
[flexcoders] Re: Programmatically create MovieClip frames?
Jason, Um, thank you for the feedback? What do you mean 'some other way?' For that matter, what do you mean, 'why would I want to?' I'd like to use animations in my application that I don't think would be easy to accomplish through scripted tweens. I could create the animations in Flash 8, but then I can't control them with AS3. I'd maybe have export each frame from Flash 8. Import them into Sprites in my Flex app, and then play them by iterating through the visible property of each one in a list... some kind of custom SuccessiveSpritePlayer class... seems like a lot of work- around, just to make what amounts to a MovieClip that I can add frames to. Does anyone have ideas, a trick, anything? //Matt --- In flexcoders@yahoogroups.com, Merrill, Jason [EMAIL PROTECTED] wrote: Why would you want to? It seems whatever you're trying to do could be accomplished in some other way. Jason Merrill Bank of America GTO Learning Leadership Development eTools Multimedia Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mtthwnthnyhys Sent: Wednesday, March 28, 2007 3:11 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Programmatically create MovieClip frames? Hey all, I have a bit of an odd question. I'm working on a project in which I'd like to include some somewhat intricate Flash animations... unfortunately... (sort of)... I'm working on one of those new MacBook Pros, with the Intel chip. No Flash 9 AS3 preview for me. I'd like to keep moving on the project, but as you probably know, Adobe is not shipping (and therefor not making available for download?) the new Flash CS3 until the end of April. So I'm wondering, is it possible to add frames to a programmatically created AS3 MovieClip, and then populate those frames dynamically? Will nextFrame() called on the last frame of a MovieClip still move the playhead?.. or return some kind of error?.. or just not do anything? I'll be experimenting with all this stuff over the next couple of days, trying to come up with a solution, but if anyone knows anything I'd appreciate the feedback. Also, if you happen to know that there's no way to do what I'm asking... and you happen to have the Flash 9 AS3 preview... would you mind making a few empty AS3 MovieClip SWFs? To be safe, I think one each at 7, 14, 21, and 28 frames would be great. That's not too much trouble is it? Okay, infinite thank yous in advance. //Matthew Anthony Hayes
[flexcoders] Re: Programmatically create MovieClip frames?
Hmm, okay, so, to clarify. It's like Paul said. It's not so much that I WANT to add frames, it's that I'm on an Intel Mac, and don't have access to the Flash 9 AS3 preview, and so, CANT add frames in Flash... at least not if I still want control over the MovieClips... even simple control like... stop(), or gotoAndPlay(), etc... don't work with AVM1MovieClips... which is all I can make until I can get my hands on Flash CS3... at the end of April. Does it make more sense now? I want to create a set of character animations that represent said character's set of states, and can smoothly transition to/from one another, or loop over a set of frames if no transition is necessary. Does it make more sense now? Okay, thanks for helping, for real, //Matt --- In flexcoders@yahoogroups.com, Merrill, Jason [EMAIL PROTECTED] wrote: You can use the Flash 9 AS3 preview to output AS3 compatible .swf animations. - I guess I don't see what you need the extra frames for? Why do you want to add frames? I guess my feedback was aimed and getting you to explain why you need to programatically add frames - I'm not following what you're trying to do I guess. If they are animations you cannot easily do with actionscript, then that means you're hand-tweening them in Flash or some other tool, and thus would have the ability to add frames anyway. Jason Merrill Bank of America GTO Learning Leadership Development eTools Multimedia Team From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of mtthwnthnyhys Sent: Thursday, March 29, 2007 8:11 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Programmatically create MovieClip frames? Jason, Um, thank you for the feedback? What do you mean 'some other way?' For that matter, what do you mean, 'why would I want to?' I'd like to use animations in my application that I don't think would be easy to accomplish through scripted tweens. I could create the animations in Flash 8, but then I can't control them with AS3. I'd maybe have export each frame from Flash 8. Import them into Sprites in my Flex app, and then play them by iterating through the visible property of each one in a list... some kind of custom SuccessiveSpritePlayer class... seems like a lot of work- around, just to make what amounts to a MovieClip that I can add frames to. Does anyone have ideas, a trick, anything? //Matt --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Merrill, Jason jason.merrill@ wrote: Why would you want to? It seems whatever you're trying to do could be accomplished in some other way. Jason Merrill Bank of America GTO Learning Leadership Development eTools Multimedia Team From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of mtthwnthnyhys Sent: Wednesday, March 28, 2007 3:11 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Programmatically create MovieClip frames? Hey all, I have a bit of an odd question. I'm working on a project in which I'd like to include some somewhat intricate Flash animations... unfortunately... (sort of)... I'm working on one of those new MacBook Pros, with the Intel chip. No Flash 9 AS3 preview for me. I'd like to keep moving on the project, but as you probably know, Adobe is not shipping (and therefor not making available for download?) the new Flash CS3 until the end of April. So I'm wondering, is it possible to add frames to a programmatically created AS3 MovieClip, and then populate those frames dynamically? Will nextFrame() called on the last frame of a MovieClip still move the playhead?.. or return some kind of error?.. or just not do anything? I'll be experimenting with all this stuff over the next couple of days, trying to come up with a solution, but if anyone knows anything I'd appreciate the feedback. Also, if you happen to know that there's no way to do what I'm asking... and you happen to have the Flash 9 AS3 preview... would you mind making a few empty AS3 MovieClip SWFs? To be safe, I think one each at 7, 14, 21, and 28 frames would be great. That's not too much trouble
[flexcoders] Programmatically create MovieClip frames?
Hey all, I have a bit of an odd question. I'm working on a project in which I'd like to include some somewhat intricate Flash animations... unfortunately... (sort of)... I'm working on one of those new MacBook Pros, with the Intel chip. No Flash 9 AS3 preview for me. I'd like to keep moving on the project, but as you probably know, Adobe is not shipping (and therefor not making available for download?) the new Flash CS3 until the end of April. So I'm wondering, is it possible to add frames to a programmatically created AS3 MovieClip, and then populate those frames dynamically? Will nextFrame() called on the last frame of a MovieClip still move the playhead?.. or return some kind of error?.. or just not do anything? I'll be experimenting with all this stuff over the next couple of days, trying to come up with a solution, but if anyone knows anything I'd appreciate the feedback. Also, if you happen to know that there's no way to do what I'm asking... and you happen to have the Flash 9 AS3 preview... would you mind making a few empty AS3 MovieClip SWFs? To be safe, I think one each at 7, 14, 21, and 28 frames would be great. That's not too much trouble is it? Okay, infinite thank yous in advance. //Matthew Anthony Hayes
[flexcoders] AS3 Browser weirdness!!??
Hey all, I'm working on some physics/game stuff... not typical Flex area of concern, but... well eventually I'll be making use of the Flex specific stuff, and for now I want to write in in AS3 and am on a Mac, so no AS3 Preview for me... :( Anyways, I wrote a little function to try and capture persistent key press... as the Key.isDown() got deprecated. It looks like this: private var l:uint; //left private var u:uint; //up private var r:uint; //right private var d:uint; //down private function persistKeyDown(event:KeyboardEvent):void { if(event.keyCode == Keyboard.LEFT) { l = setInterval(control, 10, event); } if(event.keyCode == Keyboard.UP) { u = setInterval(control, 10, event); } if(event.keyCode == Keyboard.RIGHT) { r = setInterval(control, 10, event); } if(event.keyCode == Keyboard.DOWN) { d = setInterval(control, 10, event); } //tFrame.text = keyDown: + event.keyCode; } private function persistKeyUp(event:KeyboardEvent):void { if(event.keyCode == Keyboard.LEFT) { clearInterval(l); } if(event.keyCode == Keyboard.UP) { clearInterval(u); } if(event.keyCode == Keyboard.RIGHT) { clearInterval(r); } if(event.keyCode == Keyboard.DOWN) { clearInterval(d); } //tFrame.text = keyUp: + event.keyCode; } The control function just applies forces to an object on the screen. I have the seperate intervals for each key so that I can catch simultaneous keys being held down... is that right? I think I must be doing something wrong, because, though it works fine in FireFox, it behaves all weird in Safari. You can check it out here: http://www.noncehence.com/game/experiments/test05.html Ideally, the green ball should bounce off the walls and the grey box. You'll have to click inside the canvas to give it focus, and you can control the green ball with the arrow keys. It's actually kind of fun already, but only in FireFox. In Safari, the green ball seems to get stuck in one direction or another and magnatize to a wall. Is there a difference between how keyDown/Up events are dispatched in various browsers? That doesn't make any sense to me... but then, I don't know why I'm having this problem. If anyone can help, or has other questions for me, please let me know. Thanks much, //Matt
[flexcoders] Re: Re: AS3 Browser weirdness!!??... Thanks!!
Hey Troy, Thanks! That was totally it! Fixed the browser problem, and it's way less code... awesome! //Matt --- In flexcoders@yahoogroups.com, Troy Gilbert [EMAIL PROTECTED] wrote: Not sure what you're specific problem may be, but to answer the question of what to do since there's no Key.isDown()... I borrowed this from Andre Michelle... works a charm. private var keyState:Array = new Array(); private function handleKeyDown(event:KeyboardEvent):void { keyState[event.keyCode] = true; } private function handleKeyUp(event:KeyboardEvent):void { keyState[event.keyCode] = false; } This takes advantage of the fact that AS3 arrays are sparse (otherwise you could just use an Object or Dictionary). Just replace any calls to Key.isDown() with keyState[Keyboard.CONSTANT]. Troy. On 20 Mar 2007 05:22:18 -0700, mtthwnthnyhys [EMAIL PROTECTED] wrote: Hey all, I'm working on some physics/game stuff... not typical Flex area of concern, but... well eventually I'll be making use of the Flex specific stuff, and for now I want to write in in AS3 and am on a Mac, so no AS3 Preview for me... :( Anyways, I wrote a little function to try and capture persistent key press... as the Key.isDown() got deprecated. It looks like this: private var l:uint; //left private var u:uint; //up private var r:uint; //right private var d:uint; //down private function persistKeyDown(event:KeyboardEvent):void { if(event.keyCode == Keyboard.LEFT) { l = setInterval(control, 10, event); } if(event.keyCode == Keyboard.UP) { u = setInterval(control, 10, event); } if(event.keyCode == Keyboard.RIGHT) { r = setInterval(control, 10, event); } if(event.keyCode == Keyboard.DOWN) { d = setInterval(control, 10, event); } //tFrame.text = keyDown: + event.keyCode; } private function persistKeyUp(event:KeyboardEvent):void { if(event.keyCode == Keyboard.LEFT) { clearInterval(l); } if(event.keyCode == Keyboard.UP) { clearInterval(u); } if(event.keyCode == Keyboard.RIGHT) { clearInterval(r); } if(event.keyCode == Keyboard.DOWN) { clearInterval(d); } //tFrame.text = keyUp: + event.keyCode; } The control function just applies forces to an object on the screen. I have the seperate intervals for each key so that I can catch simultaneous keys being held down... is that right? I think I must be doing something wrong, because, though it works fine in FireFox, it behaves all weird in Safari. You can check it out here: http://www.noncehence.com/game/experiments/test05.html Ideally, the green ball should bounce off the walls and the grey box. You'll have to click inside the canvas to give it focus, and you can control the green ball with the arrow keys. It's actually kind of fun already, but only in FireFox. In Safari, the green ball seems to get stuck in one direction or another and magnatize to a wall. Is there a difference between how keyDown/Up events are dispatched in various browsers? That doesn't make any sense to me... but then, I don't know why I'm having this problem. If anyone can help, or has other questions for me, please let me know. Thanks much, //Matt
[flexcoders] Re: LiveDocs Offline
Yes!! It seems intermittent though... I get the Flex 2 Language Reference (at the moment) but not the Programming AS3 book. Says: Page Does Not Exist. Later, when I reload the same page, it'll work fine. WEIRDNESS! If it helps at all, I'm on one of those new-fangled Intel MacBook Pros, looking at the web through Safari. Just hang in there, keep trying. //Matt --- In flexcoders@yahoogroups.com, lostinrecursion [EMAIL PROTECTED] wrote: Is anyone else experiencing issues accessing LiveDocs for all Adobe technologies today? So far, I am having issues with CF and Flex. I am receiving page not found errors and strange loading of the docs. I did a Google and can't believe that if it is the case, we have not been notified somehow. -LIR