[Flashcoders] Scope of variables declared in for loop
Hello, has anybody else noticed, that the code like: stop(); for (var i:Number = 0; i < 10; i++) { trace('1st loop: ' + i); } for (var i:Number = 0; i < 10; i++) { trace('2nd loop: ' + i); } won't be accepted by compiler? Is there an explanation for that? The other languages wouldn't complain here Regards Alex ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scope of variables declared in for loop
Hello :) Your code is in AS3 ? In AS3 : var i:int ; // only one for ( i = 0; i < 10; i++) { trace('1st loop: ' + i); } for ( i = 0; i < 10; i++) { trace('2nd loop: ' + i); } The FlashPlayer 9 or 10 optimize the variables and you must implement a variable one time in the same expression of code ;) eKA+ :) 2008/12/23 Alexander Farber > Hello, > > has anybody else noticed, that the code like: > > stop(); > > for (var i:Number = 0; i < 10; i++) { >trace('1st loop: ' + i); > } > > for (var i:Number = 0; i < 10; i++) { >trace('2nd loop: ' + i); > } > > won't be accepted by compiler? > Is there an explanation for that? > The other languages wouldn't complain here > > Regards > Alex > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scope of variables declared in for loop
- Original Message - From: "Alexander Farber" To: "Flash Coders List" Sent: Tuesday, December 23, 2008 10:02 AM Subject: [Flashcoders] Scope of variables declared in for loop Hello, has anybody else noticed, that the code like: stop(); for (var i:Number = 0; i < 10; i++) { trace('1st loop: ' + i); } for (var i:Number = 0; i < 10; i++) { trace('2nd loop: ' + i); } won't be accepted by compiler? Yes. Is there an explanation for that? Flash doesn't scope the variables to the loop block, but to the code section. The other languages wouldn't complain here No, they wouldn't. Paul Regards Alex ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scope of variables declared in for loop
Hello, yes in AS3, but I think AS2 had the same irritating issue. Sure you can put var i:int above. But in many other languages (like C++, Java, Perl) you write something like for (my $i = 0; $i < 10; $i++) { # XXX } an the scope of variable is limited to the loop only. Regards Alex On Tue, Dec 23, 2008 at 11:22 AM, ekameleon wrote: > Your code is in AS3 ? > > In AS3 : > > var i:int ; // only one > > for ( i = 0; i < 10; i++) > { > trace('1st loop: ' + i); > } > > for ( i = 0; i < 10; i++) > { > trace('2nd loop: ' + i); > } > > The FlashPlayer 9 or 10 optimize the variables and you must implement a > variable one time in the same expression of code ;) > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scope of variables declared in for loop
How do you define a "code section" then? Regards Alex On Tue, Dec 23, 2008 at 11:25 AM, Paul Andrews wrote: >> Is there an explanation for that? > > Flash doesn't scope the variables to the loop block, but to the code > section. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Scope of variables declared in for loop
If you want to make the scope "local", you can do it in a function or in a class. Function doLoop1():void{ for ( i = 0; i < 10; i++) { trace('1st loop: ' + i); } } Function doLoop2():void{ for ( i = 0; i < 10; i++) { trace('2nd loop: ' + i); } } If you would like the result outside of the function, use return varResult; HTH Cor -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Alexander Farber Sent: dinsdag 23 december 2008 11:35 To: Flash Coders List Subject: Re: [Flashcoders] Scope of variables declared in for loop Hello, yes in AS3, but I think AS2 had the same irritating issue. Sure you can put var i:int above. But in many other languages (like C++, Java, Perl) you write something like for (my $i = 0; $i < 10; $i++) { # XXX } an the scope of variable is limited to the loop only. Regards Alex On Tue, Dec 23, 2008 at 11:22 AM, ekameleon wrote: > Your code is in AS3 ? > > In AS3 : > > var i:int ; // only one > > for ( i = 0; i < 10; i++) > { > trace('1st loop: ' + i); > } > > for ( i = 0; i < 10; i++) > { > trace('2nd loop: ' + i); > } > > The FlashPlayer 9 or 10 optimize the variables and you must implement a > variable one time in the same expression of code ;) > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders No virus found in this incoming message. Checked by AVG - http://www.avg.com Version: 8.0.176 / Virus Database: 270.10.0/1861 - Release Date: 22-12-2008 11:23 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Scope of variables declared in for loop
Oops, forgot to declare the i properly. So again: Function doLoop1():void{ for (var i:int = 0; i < 10; i++) { trace('1st loop: ' + i); } } Function doLoop2():void{ for (var i:int = 0; i < 10; i++) { trace('2nd loop: ' + i); } } If you would like the result outside of the function, use return varResult; ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scope of variables declared in for loop
a method / function or a class / frame On Tue, Dec 23, 2008 at 10:37 AM, Alexander Farber < alexander.far...@gmail.com> wrote: > How do you define a "code section" then? > > Regards > Alex > > On Tue, Dec 23, 2008 at 11:25 AM, Paul Andrews wrote: > > >> Is there an explanation for that? > > > > Flash doesn't scope the variables to the loop block, but to the code > > section. > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Scope of variables declared in for loop
Yes, in AS 2 and AS 3 you have a local scope and global scope and that's it. You can't create new "nested" scopes using braces or other means. The variable declaration will be moved to the top of the function by the compiler (I think this is called "hoisting"). So if you write: function test(param:Boolean):void { if(param) { var someVar:int = 10; } } It'd be compiled as if you wrote: function test(param:Boolean):void { var someVar:int; if(param) { someVar = 10; } } You can also reference someVar outside the if in the first case, which I think won't be the case in other languages with more complex scoping rules. Cheers Juan Pablo Califano 2008/12/23 Alexander Farber > Hello, yes in AS3, but I think AS2 had the same irritating issue. > > Sure you can put var i:int above. > > But in many other languages (like C++, Java, Perl) you write something like > > for (my $i = 0; $i < 10; $i++) { > # XXX > } > > an the scope of variable is limited to the loop only. > > Regards > Alex > > On Tue, Dec 23, 2008 at 11:22 AM, ekameleon wrote: > > Your code is in AS3 ? > > > > In AS3 : > > > > var i:int ; // only one > > > > for ( i = 0; i < 10; i++) > > { > > trace('1st loop: ' + i); > > } > > > > for ( i = 0; i < 10; i++) > > { > > trace('2nd loop: ' + i); > > } > > > > The FlashPlayer 9 or 10 optimize the variables and you must implement a > > variable one time in the same expression of code ;) > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RE: Flash AS3 debugging
In my experience, the Flash IDE debbuger is and has been itself full of bugs and close to useless. I desisted using it a long time ago. When you have an app of medium complexity (and sometimes even with really simple stuff), 7 out of 10 times it will hang or crash. And I don't think Adobe will put much effort in improving it, since Flash is considered a designers' tool and designers generally don't use a debugger. Flex builder's debugger in other hand is a decent tool. Sorry for the rant, I know it doesn't add much, but I always regreted that Flash had such a crapy debugger. Cheers Juan Pablo Califano 2008/12/22 Mendelsohn, Michael > Thanks, that's a great article...but this is a really weird issue. It > might be some sort of Windows bug. > > I hit a break point, things are rendered on the stage. As soon as I > click stepIn in the debug console, the swf window crashes (not > responding). > > - MM > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] RE: Flash AS3 debugging
Mendelsohn, Michael wrote: Thanks, that's a great article...but this is a really weird issue. It might be some sort of Windows bug. I hit a break point, things are rendered on the stage. As soon as I click stepIn in the debug console, the swf window crashes (not responding). - MM ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders When the breakpoint is hit, the Flash IDE takes over and the swf stops. The same happens in Flex. Typically, if you then attempt to close down the browser it says it has stopped responding but when you continue in the debugger control is regained. The Flex Builder debugger is fantastic compared to Flash's one - but not perfect. Microsoft's debugger for C/C++ programs puts an interrupt code byte at the place it wants control and this causes control to pass to the debugger. This is the same sort of thing happening here. John ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3: Dispatching events to further listeners, but not to itself
Hello, I have 2 classes: PlayingCard and PlayingTable. The PlayingCard listens on MOUSE_UP, DOWN and MOVE to call startDrag() and stopDrag(). I do not want to introduce custom events, so I try to subscribe the PlayingTable to MOUSE_MOVE and MOUSE_UP events of each PlayingCard, so that the table can: 1) Detect that a PlayingCard is being dragged to a right spot (depending on the current phase of the game - for ex. from the dealer to the player), so that it can change color (like glow in green) 2) Detect that the mouse has been released after dragging a PlayingCard and check if the move been valid. My problem is that when I try to dispatch the MOUSE_MOVE events, then the PlayingCard receives it again and again and gives me the runtime error: Error #2094: Event dispatch recursion overflow. at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at Card/handleMouseMove() Has anybody please a solution for this probably often occuring problem? Thank you Alex PS: Here is my current troublesome code: public function PlayingCard() { .. addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown); } private function handleMouseDown(event:MouseEvent):void { addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove); ... startDrag(); } private function handleMouseUp(event:MouseEvent):void { removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp); removeEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove); .. stopDrag(); } private function handleMouseMove(event:MouseEvent):void { // XXX trying to reuse the MOUSE_MOVE event // XXX and to dispatch it to PlayingTable - fails :-( dispatchEvent(event); } ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] AS3 CSS + styling solutions
apologies if this is a tad vague, but i'm looking for a styling solution in AS3. We're looking for something that is more along the lines of a style manager to apply CSS formatting to be used in an MVC framework. if anyone knows of such tools please advise. thanks. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Are you waiting ages for your copy of CS4?
Hi, Sorry to be slightly off-topic, but I am forced to extreme measures. I have been waiting since late October for my copy of CS4 Design Premium to ship. We have been told its 'in processing' and all number of things. I've even been told its been shipped by one representative, even though that was a complete lie. I'm pretty sure there is something going on. It shouldn't take two months to ship out a cd, and they won't refund our money. Does this sound like you? Please email me on or off list... Thanks Chris Hill ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: Dispatching events to further listeners, but not to itself
you might find that using MOUSE_MOVE is a little heavy on the processor as it can fire multiple times, even within the same frame it's probably better to use Event.ENTER_FRAME and check for the mouseX and mouseY and while you're at it, you might as well use the same listener to move the card rather than startDrag()/stopDrag() don't know if it would help, though a On Tue, Dec 23, 2008 at 4:49 PM, Joel Stransky wrote: > Why not just include the detection logic inside the handlers you already > have? > > On Tue, Dec 23, 2008 at 9:52 AM, Alexander Farber < > alexander.far...@gmail.com> wrote: > > > Hello, > > > > I have 2 classes: PlayingCard and PlayingTable. > > > > The PlayingCard listens on MOUSE_UP, DOWN > > and MOVE to call startDrag() and stopDrag(). > > > > I do not want to introduce custom events, > > so I try to subscribe the PlayingTable to > > MOUSE_MOVE and MOUSE_UP events > > of each PlayingCard, so that the table can: > > > > 1) Detect that a PlayingCard is being > >dragged to a right spot (depending on > >the current phase of the game - for ex. > >from the dealer to the player), so that > >it can change color (like glow in green) > > > > 2) Detect that the mouse has been > >released after dragging a PlayingCard > >and check if the move been valid. > > > > My problem is that when I try to dispatch > > the MOUSE_MOVE events, then the > > PlayingCard receives it again and again > > and gives me the runtime error: > > > > Error #2094: Event dispatch recursion overflow. > >at flash.events::EventDispatcher/dispatchEventFunction() > >at flash.events::EventDispatcher/dispatchEvent() > >at Card/handleMouseMove() > > > > Has anybody please a solution for > > this probably often occuring problem? > > > > Thank you > > Alex > > > > PS: Here is my current troublesome code: > > > >public function PlayingCard() { > > .. > > addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown); > >} > > > >private function handleMouseDown(event:MouseEvent):void { > >addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); > >addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove); > >... > >startDrag(); > >} > > > >private function handleMouseUp(event:MouseEvent):void { > >removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp); > >removeEventListener(MouseEvent.MOUSE_MOVE, > handleMouseMove); > >.. > >stopDrag(); > >} > > > >private function handleMouseMove(event:MouseEvent):void { > >// XXX trying to reuse the MOUSE_MOVE event > >// XXX and to dispatch it to PlayingTable - fails :-( > > > >dispatchEvent(event); > >} > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > -- > --Joel Stransky > stranskydesign.com > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 CSS + styling solutions
what would you want to style with it? On Tue, Dec 23, 2008 at 3:59 PM, Jah wrote: > apologies if this is a tad vague, but i'm looking for a styling solution in > AS3. We're looking for something that is more along the lines of a style > manager to apply CSS formatting to be used in an MVC framework. if anyone > knows of such tools please advise. thanks. > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3: Dispatching events to further listeners, but not to itself
Why not just include the detection logic inside the handlers you already have? On Tue, Dec 23, 2008 at 9:52 AM, Alexander Farber < alexander.far...@gmail.com> wrote: > Hello, > > I have 2 classes: PlayingCard and PlayingTable. > > The PlayingCard listens on MOUSE_UP, DOWN > and MOVE to call startDrag() and stopDrag(). > > I do not want to introduce custom events, > so I try to subscribe the PlayingTable to > MOUSE_MOVE and MOUSE_UP events > of each PlayingCard, so that the table can: > > 1) Detect that a PlayingCard is being >dragged to a right spot (depending on >the current phase of the game - for ex. >from the dealer to the player), so that >it can change color (like glow in green) > > 2) Detect that the mouse has been >released after dragging a PlayingCard >and check if the move been valid. > > My problem is that when I try to dispatch > the MOUSE_MOVE events, then the > PlayingCard receives it again and again > and gives me the runtime error: > > Error #2094: Event dispatch recursion overflow. >at flash.events::EventDispatcher/dispatchEventFunction() >at flash.events::EventDispatcher/dispatchEvent() >at Card/handleMouseMove() > > Has anybody please a solution for > this probably often occuring problem? > > Thank you > Alex > > PS: Here is my current troublesome code: > >public function PlayingCard() { > .. > addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown); >} > >private function handleMouseDown(event:MouseEvent):void { >addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); >addEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove); >... >startDrag(); >} > >private function handleMouseUp(event:MouseEvent):void { >removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp); >removeEventListener(MouseEvent.MOUSE_MOVE, handleMouseMove); >.. >stopDrag(); >} > >private function handleMouseMove(event:MouseEvent):void { >// XXX trying to reuse the MOUSE_MOVE event >// XXX and to dispatch it to PlayingTable - fails :-( > >dispatchEvent(event); >} > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- --Joel Stransky stranskydesign.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] AS3 CSS + styling solutions
text in multiple views. On Tue, Dec 23, 2008 at 12:01 PM, allandt bik-elliott (thefieldcomic.com) < alla...@gmail.com> wrote: > what would you want to style with it? > > On Tue, Dec 23, 2008 at 3:59 PM, Jah wrote: > > > apologies if this is a tad vague, but i'm looking for a styling solution > in > > AS3. We're looking for something that is more along the lines of a style > > manager to apply CSS formatting to be used in an MVC framework. if anyone > > knows of such tools please advise. thanks. > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Flash vs. Flex libraries
1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple as adding source files and/or SWCs to an FLA project's classpath? And, where are all these libraries (Windows XP or Vista)? 2. If yes, any important caveats? 3. Am I correct that all the Flash libraries (that is, all those included in Flash CS3) are available by default (at least in compiled form) within Flex Builder (the Flex SDK)? My company has artists working in Flash CS3 (planning move to CS4), and programmers working in Flex Builder. The general work flow has been for the artists to create "art" assets which the programmers incorporate into applications using ActionScript. For various reasons, right or wrong, we programmers are *not* developing apps as Flex apps (no MXML), but as "ActionScript Projects". The upshot of this has been that we've tended not to take advantage of all the Flex libraries, either from ignorance or due to documentation that assumes the MXML context and can obscure how/whether its possible to use these within "plain" ActionScript projects. This issue has arisen different times, but the particular problem case I'm running into now is wanting to create Flash components which make use of the Flex libraries. In fact, I'm confused as to which libraries are and are not available by default in CS3, since components themselves use things like UIComponent, which is documented as part of Flex. Thanks for any help! Jason Boyd Extra credit questions: [Embed]ding SWFs and SWF Symbols into ActionScript class files is one way to cause Flash's main display classes of MovieClip and Button to extend UIComponent. Are there other ways? Ideally we would get art from the artists and have the runtime accessible objects be managed as Class instances within the Flex hierarchy, to take advantage of things like the automation framework. How are others doing this, if they are? Is there some way to use [Bindable] on properties within Flash CS3? I have a component that pulls in a class that uses this metadata tag and it compiles in Flash CS3, but there doesn't appear to be any way to bind the Bindable property, since there's no MXML and BindingUtils is in a Flex library not included with Flash. Anyone know of simple docs on *creating* custom components, as opposed to skinning or modifying existing ones? I'm not afraid of coding around a potentially complex framework, but I'd like to understand how it's supposed to be done. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash vs. Flex libraries
Caveat: I believe there has been some progress recently on the use of Flex components created as .swcs for use within Flash CS4. You'll probably need to look on Adobe Labs for more info on that. Other than that, to the best of my knowledge the answers are: > 1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple > as adding source files and/or SWCs to an FLA project's classpath? And, > where are all these libraries (Windows XP or Vista)? No. This is partly because the compiler included with CS3/4 is different from the compiler used for Flex. The Flex SDK compiler (also used by Flex builder) supports [Embed] tags, supports [Bindable], supports compilation of CSS, resource bundles and MXML. The Flash IDE compiler doesn't. > 2. If yes, any important caveats? See 1. :-) > 3. Am I correct that all the Flash libraries (that is, all those > included in Flash CS3) are available by default (at least in compiled > form) within Flex Builder (the Flex SDK)? No. All the flash.x.xx libraries are available (they are player native libraries) but none of the fl.x.xx libraries are. > [Embed]ding SWFs and SWF Symbols into ActionScript class files is one > way to cause Flash's main display classes of MovieClip and Button to > extend UIComponent. Are there other ways? Ideally we would get art > from the artists and have the runtime accessible objects be managed as > Class instances within the Flex hierarchy, to take advantage of things > like the automation framework. How are others doing this, if they are? We use [Embed] within classes or MXML. We also use resource bundles (.properties files) and CSS, both of which can embed symbols from source .swf files (and from images, mp3s, fonts etc.). Our artists produce those .swfs, we embed the symbols appropriately. > Is there some way to use [Bindable] on properties within Flash CS3? I > have a component that pulls in a class that uses this metadata tag and > it compiles in Flash CS3, but there doesn't appear to be any way to > bind the Bindable property, since there's no MXML and BindingUtils is > in a Flex library not included with Flash. Not as far as I am aware. > Anyone know of simple docs on *creating* custom components, as opposed > to skinning or modifying existing ones? I'm not afraid of coding > around a potentially complex framework, but I'd like to understand how > it's supposed to be done. There is a reference for creating custom Flex components here: http://livedocs.adobe.com/flex/3/html/Part3_as_components_1.html Hope that helps, Ian ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash vs. Flex libraries
Thanks Ian! Helps clarify a lot! -Jason 2008/12/23 Ian Thomas : > Caveat: I believe there has been some progress recently on the use of > Flex components created as .swcs for use within Flash CS4. You'll > probably need to look on Adobe Labs for more info on that. > > Other than that, to the best of my knowledge the answers are: > >> 1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple >> as adding source files and/or SWCs to an FLA project's classpath? And, >> where are all these libraries (Windows XP or Vista)? > > No. This is partly because the compiler included with CS3/4 is > different from the compiler used for Flex. The Flex SDK compiler (also > used by Flex builder) supports [Embed] tags, supports [Bindable], > supports compilation of CSS, resource bundles and MXML. The Flash IDE > compiler doesn't. > >> 2. If yes, any important caveats? > > See 1. :-) > >> 3. Am I correct that all the Flash libraries (that is, all those >> included in Flash CS3) are available by default (at least in compiled >> form) within Flex Builder (the Flex SDK)? > > No. All the flash.x.xx libraries are available (they are player native > libraries) but none of the fl.x.xx libraries are. > >> [Embed]ding SWFs and SWF Symbols into ActionScript class files is one >> way to cause Flash's main display classes of MovieClip and Button to >> extend UIComponent. Are there other ways? Ideally we would get art >> from the artists and have the runtime accessible objects be managed as >> Class instances within the Flex hierarchy, to take advantage of things >> like the automation framework. How are others doing this, if they are? > > We use [Embed] within classes or MXML. We also use resource bundles > (.properties files) and CSS, both of which can embed symbols from > source .swf files (and from images, mp3s, fonts etc.). Our artists > produce those .swfs, we embed the symbols appropriately. > >> Is there some way to use [Bindable] on properties within Flash CS3? I >> have a component that pulls in a class that uses this metadata tag and >> it compiles in Flash CS3, but there doesn't appear to be any way to >> bind the Bindable property, since there's no MXML and BindingUtils is >> in a Flex library not included with Flash. > > Not as far as I am aware. > >> Anyone know of simple docs on *creating* custom components, as opposed >> to skinning or modifying existing ones? I'm not afraid of coding >> around a potentially complex framework, but I'd like to understand how >> it's supposed to be done. > > There is a reference for creating custom Flex components here: > http://livedocs.adobe.com/flex/3/html/Part3_as_components_1.html > > Hope that helps, > Ian > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash vs. Flex libraries
Jason, There is actually a way to use Flex classes in Flash CS3 -- I figured it out a couple weeks ago when building a jabber client in AS3 using the XIFF API (I wanted to use Flash, not Flex). It's quite simple actually... I just put up a blog post about it. http://gigafied.blogspot.com/2008/12/using-flex-classes-in-flash-cs3.html Hope that helps!! - Taka On Tue, Dec 23, 2008 at 2:59 PM, Jason Boyd wrote: > Thanks Ian! Helps clarify a lot! > -Jason > > 2008/12/23 Ian Thomas : > > Caveat: I believe there has been some progress recently on the use of > > Flex components created as .swcs for use within Flash CS4. You'll > > probably need to look on Adobe Labs for more info on that. > > > > Other than that, to the best of my knowledge the answers are: > > > >> 1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple > >> as adding source files and/or SWCs to an FLA project's classpath? And, > >> where are all these libraries (Windows XP or Vista)? > > > > No. This is partly because the compiler included with CS3/4 is > > different from the compiler used for Flex. The Flex SDK compiler (also > > used by Flex builder) supports [Embed] tags, supports [Bindable], > > supports compilation of CSS, resource bundles and MXML. The Flash IDE > > compiler doesn't. > > > >> 2. If yes, any important caveats? > > > > See 1. :-) > > > >> 3. Am I correct that all the Flash libraries (that is, all those > >> included in Flash CS3) are available by default (at least in compiled > >> form) within Flex Builder (the Flex SDK)? > > > > No. All the flash.x.xx libraries are available (they are player native > > libraries) but none of the fl.x.xx libraries are. > > > >> [Embed]ding SWFs and SWF Symbols into ActionScript class files is one > >> way to cause Flash's main display classes of MovieClip and Button to > >> extend UIComponent. Are there other ways? Ideally we would get art > >> from the artists and have the runtime accessible objects be managed as > >> Class instances within the Flex hierarchy, to take advantage of things > >> like the automation framework. How are others doing this, if they are? > > > > We use [Embed] within classes or MXML. We also use resource bundles > > (.properties files) and CSS, both of which can embed symbols from > > source .swf files (and from images, mp3s, fonts etc.). Our artists > > produce those .swfs, we embed the symbols appropriately. > > > >> Is there some way to use [Bindable] on properties within Flash CS3? I > >> have a component that pulls in a class that uses this metadata tag and > >> it compiles in Flash CS3, but there doesn't appear to be any way to > >> bind the Bindable property, since there's no MXML and BindingUtils is > >> in a Flex library not included with Flash. > > > > Not as far as I am aware. > > > >> Anyone know of simple docs on *creating* custom components, as opposed > >> to skinning or modifying existing ones? I'm not afraid of coding > >> around a potentially complex framework, but I'd like to understand how > >> it's supposed to be done. > > > > There is a reference for creating custom Flex components here: > > http://livedocs.adobe.com/flex/3/html/Part3_as_components_1.html > > > > Hope that helps, > > Ian > > ___ > > Flashcoders mailing list > > Flashcoders@chattyfig.figleaf.com > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash vs. Flex libraries
Taka, That's really interesting - excellent to know! I _suspect_ (having had previous bad experiences) that doing things within the _complete_ Flex framework will be difficult/will cause errors. Flex has a lot of managers/singletons which seem to be very greedy, and assume a lot i.e. assume some Flex startup code is called up front and assume things are initialised in a particular order. Definitely worth trying, though! Cheers, Ian On Tue, Dec 23, 2008 at 11:24 PM, Taka Kojima wrote: > Jason, > > There is actually a way to use Flex classes in Flash CS3 -- I figured it out > a couple weeks ago when building a jabber client in AS3 using the XIFF API > (I wanted to use Flash, not Flex). > > It's quite simple actually... I just put up a blog post about it. > > http://gigafied.blogspot.com/2008/12/using-flex-classes-in-flash-cs3.html > > Hope that helps!! > > - Taka > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash vs. Flex libraries
are you SURE you can't use embed metadata in Flash CS4? ;) Eric On 12/23/2008, Ian Thomas wrote: > > Taka, > That's really interesting - excellent to know! > > I _suspect_ (having had previous bad experiences) that doing things > within the _complete_ Flex framework will be difficult/will cause > errors. Flex has a lot of managers/singletons which seem to be very > greedy, and assume a lot i.e. assume some Flex startup code is called > up front and assume things are initialised in a particular order. > Definitely worth trying, though! > > Cheers, > Ian > > On Tue, Dec 23, 2008 at 11:24 PM, Taka Kojima wrote: > > Jason, > > > > There is actually a way to use Flex classes in Flash CS3 -- I figured it > out > > a couple weeks ago when building a jabber client in AS3 using the XIFF > API > > (I wanted to use Flash, not Flex). > > > > It's quite simple actually... I just put up a blog post about it. > > > > > http://gigafied.blogspot.com/2008/12/using-flex-classes-in-flash-cs3.html > > > > Hope that helps!! > > > > - Taka > > > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Are you waiting ages for your copy of CS4?
Maybe the courier lost the package? Maybe ask for a tracking number ;) ? Hi, Sorry to be slightly off-topic, but I am forced to extreme measures. I have been waiting since late October for my copy of CS4 Design Premium to ship. We have been told its 'in processing' and all number of things. I've even been told its been shipped by one representative, even though that was a complete lie. I'm pretty sure there is something going on. It shouldn't take two months to ship out a cd, and they won't refund our money. Does this sound like you? Please email me on or off list... Thanks Chris Hill ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Custom buttons - radio style
Thanks for your response Ashim,I will try to place the movieclip buttons into a new unique MovieClip, and then link that mc to a new custom RadioGroup class. We'll see where that leads me and I'll report back with my findings (or lack of).Any other ideas out there?thanks again Jim--original message-Ashim wroteI'd say you need to wrap the system in a RadioControl class of some sort.This is a group class and knows of all the radio buttons that are affectedas part of this group. That was you can have a second group if you need it.This class can have a currentSelection variable which stores whatever isclicked. Right before you change its value though, you first reset itscontentsEg:private function onClick(e:MouseEvent):void{if (currentSelection){currentSelection.mouseEnabled = true;currentSelection.goToAndStop("up");}currentSelection = e.currentTarget;currentSelection.goToAndStop("down");currentSelection.mouseEnabled = false;}I'm not entirely sure how you can connect things from the Flash library. I'dgenerate the buttons from the group class.However you could put all the buttons into a movieclip and type as the groupclass. I guess you can then run through the names and assign listeners. THatmay not be the best though.Ashim2008/12/23 jim skolmoski >> Listers,As an experienced AS2 coder, and a very new AS3 coder, I'm having> trouble writing some classes.Since I work with a few Flash designers, I'm> hoping that I can create some classes that would automatically add> functionality to interactive programs that they are designing.The current> project's design calls for a left nav with custom buttons. Each of these> buttons (movieclips) have UP, OVER, and DOWN states (as labels). As a button> is selected by the user, that button will remain in DOWN state and lose its> functionality (via several removeEventListeners). Then as a different> button is selected from the left nav, I would like it to enter a DOWN state,> and also trigger an event that would make the initial button move to its UP> state and gain functionality once again.I have a MainNav class that provides> all the functionality for the buttons. My designers would simply name the> stage instance to "MainNav1_MainLabel1" and link the button movieclips to my> class. My class will dissect the instance name to to two items: the> button's name and the label that the root should gotoAndStop. I however> have yet to figure out how to implement the communication that changes the> earlier depressed button back to the UP state when another button is> clicked. How should I implement this communication? via the document> class? make a event class?Another part of this story is that when the root> goes to another label, often times the screen will have subNav buttons which> will also work in this custom radio fashion. It would be nice if I could> use the same classes.Thanks for your timeany hints or pointers are> appreciatedJim> _> Life on your PC is safer, easier, and more enjoyable with Windows Vista(R).>> http://clk.atdmt.com/MRT/go/127032870/direct/01/___> Flashcoders mailing list> Flashcoders@chattyfig.figleaf.com> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders> _ Send e-mail faster without improving your typing skills. http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Flash vs. Flex libraries
On Dec 23, 2008, at 5:10 PM, Jason Boyd wrote: 1. Can Flex libraries (mx.*) be used in Flash CS3/4? Is this as simple as adding source files and/or SWCs to an FLA project's classpath? And, where are all these libraries (Windows XP or Vista)? Yes. http://labs.wichers.nu/2007/12/25/using-flex-compiled-code-within-flash/ Theoretically, you can use every Flex library and component within Flash. It's all SWF bytecode in the end. There are some tricks to placement of SWC files from the Flex library at the root of your source FLA to get it to recognize and compile the code. It's just very awkward and very difficult to manage in any larger scale application. I actually requested something on flexcoders quite a while back and 'lo and behold the author of this blog responded and added some additional examples to his description of how to get the RPC classes in Flash. http://labs.wichers.nu/2007/12/25/using-flex-compiled-code-within-flash/ There are a couple other posts on that blog that may help you along as well. cheers, jon ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders