if you really want to practice using the flash book then just add it to the rawChildren property and it will work in flex project and you wont get any error but be careful though since rawChildren is for non-content children and you should not really be using it. At least that is what i do when i practice was flash only actionscript examples. It does take a while to understand the whole framework so yaaa
----- Original Message ---- From: Gordon Smith <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Monday, January 21, 2008 2:58:38 PM Subject: RE: [flexcoders] Re: addchild > Why would you think that a book called "actionscript 3 animation" uses only > only > flash.* classes throughout and avoids the mx.* classes completely ? It was just a guess, because the title didn't include the word "Flex". Are you saying that this book actually does use mx.* classes? > Doesn't Flex use actionscript 3? Yes. As I said, you write AS3 to use both the flash.* classes (which are actually implemented in C++) and the mx.* classes (which are themselves implemented in AS3). And, as I said, the former are low-level classes built into the Player while the latter are high-level classes provided with the Flex framework which get linked into your SWF. > Doesn't it do animation? Yes, it can "do" animation. In fact, Flex's mx.effects.* classes ARE animation classes. But we didn't create Flex to make it easier to make balls move around the stage. The focus of Flex is not Flash-style animations and games, although some developers use it to create just that. Flex is really focused on building Rich Internet Applications, and we provide the most common components that are necessary to do that... things like ComboBox, DataGrid, DateChooser, etc. Gordon Smith Adobe Flex SDK Team From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] On Behalf Of [EMAIL PROTECTED] org Sent: Sunday, January 20, 2008 7:57 AM To: [EMAIL PROTECTED] ups.com Subject: Re: [flexcoders] Re: addchild I'm still missing something very basic. Why would you think that a book called "actionscript 3 animation" uses only only flash.* classes throughout and avoids the mx.* classes completely ? Doesn't Flex use actionscript 3? Doesn't it do animation? I bought lots of other books too, thinking they would apply to flex., such as Colin Moock's Essential Actionscript 3.0. I would like to see an example of a ball that only uses mx classes. no kidding, I have looked and looked and looked and I don't see what you might be referring to. I thought I have found it when I got to http://livedocs. adobe.com/ labs/flex3/ langref/mx/ graphics/ package-detail. html but nothing from that page shows how to make a shape and apply the graphics to it. It just uses existing components. It should have a simple axample of making a shape and adding a stroke. http://livedocs. adobe.com/ labs/flex3/ langref/mx/ graphics/ Stroke.html talks about " The Graphics object to which the Stroke's styles are applied." but the link is to flash.display <http://livedocs. adobe.com/ labs/flex3/ langref/flash/ display/package- detail.html> I did a search for mx.display, no results. I tried the example in http://livedocs. adobe.com/ labs/flex3/ html/help. html?content= Drawing_Vector_ Graphics_ 5.html var squareSize:uint = 100; var square:Shape = new Shape(); square.graphics. beginFill( 0xFF0000, 0.5); square.graphics. drawRect( 0, 0, squareSize, squareSize); square.graphics. beginFill( 0x00FF00, 0.5); square.graphics. drawRect( 200, 0, squareSize, squareSize); square.graphics. beginFill( 0x0000FF, 0.5); square.graphics. drawRect( 400, 0, squareSize, squareSize); square.graphics. endFill() ; this.addChild( square); And it turns out that these built in methods do not create a UIComponent either. TypeError: Error #1034: Type Coercion failed: cannot convert flash.display: :[EMAIL PROTECTED] to mx.core.IUIComponen t. What is going on here ? Is this because I'm using flex2 and not flex 3 ? Gordon Smith wrote: > > > The ball class is from the foundation action script 3 animation book > > and there is no import mx.core.UIComponent ; in thier example. > I'm not familiar with this book, but from the name I'd expect that > they use only flash.* classes throughout and avoid the mx.* classes > completely. You were trying to mix them by taking Ball and adding it > into VBox. If you added Ball to a Sprite-based app (rather than an > <mx:Application> -based app) you wouldn't have a problem. (You also > wouldn't get automatic layout, etc.) > > > Can you suggest a book ? > > I'm afraid that I haven't had time to investigate what's out there, > but I expect that others on the list will have suggestions. > > > It just blows my mind how bad the documentation is > > We've heard before that our examples are either too simple or too > complex. Do you have any suggestions for specific basic concepts that > aren't properly covered, or intermediate- level examples that would be > useful? If so, I'll pass them on to the doc team. > > Gordon Smith > Adobe Flex SDK Team > > ------------ --------- --------- --------- --------- --------- - > *From:* [EMAIL PROTECTED] ups.com [mailto:[EMAIL PROTECTED] ups.com] > *On Behalf Of [EMAIL PROTECTED] org > *Sent:* Thursday, January 17, 2008 11:37 PM > *To:* [EMAIL PROTECTED] ups.com > *Subject:* Re: [flexcoders] Re: addchild > > I just use whatever I can get to work. I'm happy just using flex, and > when I use some old flash its only because I don't know any better. > The ball class is from the foundation action script 3 animation book and > there is no import mx.core.UIComponent ; in thier example. > > When you say: If you're new to Flex, I suggest beginning with complete > Flex examples that use standard Flex components and postponing trying to > use Sprites-based classes. > > I'd do that if I could figure out how. The "live docs" are not good for > learning form because the examples are either not complete or are way > too complete with too many distracting bells and whistles. They need to > start with basic building blocks but they don't seem to understand the > concept. It just blows my mind how bad the documentation is. . Can you > suggest a book ? > > Gordon Smith wrote: > > > > Built in to the Flash Player are low-level flash.* classes such as > > Sprite. The Flex framework libraries contains higher-level mx.* > > classes such as UIComponent, Button, Container, VBox, etc. which add > > many capabilities beyond those in the Player. > > > > The Flex framework was designed with the assumption that most > > developers would be delighted with the greater capabilities of > > the high-level classes and not have much interest in the low-level > > ones, which are primitive by comparison. In hindsight, this was > > wrongheaded. Many people like you want to mix the two -- generally > > because the low-level classes can have greater performance or smaller > > code size, or because you're bringing over code from the > > Flash-not-Flex world -- and it isn't as easy as it should be to mix > > them. I hope we can do better in a future release. > > > > > You write AS3 code to use both flash.* and mx.* classes, and, once you > > understand a few rules, you can use both sets of classes in a Flex > > application. But it isn't completely trivial, so it's dangerous to > > just take a simple Sprite-based class and expect it to "just work" in > > Flex. > > > > The problem you're running into here is that Flex Containers such as > > VBox assume that their children are high-level UIComponents rather > > than just low-level Sprites. One reason is that containers do > > automatic layout management, which requires code in the children to > > report how big the child wants to be, etc. > > > > So currently you have to work around this assumption by doing things > > like creating an intermediate UIComponent to parent the Sprite or > > adding the Sprite to the Container as a "raw" child (see the > > rawChildren property). > > > > If you're new to Flex, I suggest beginning with complete Flex examples > > that use standard Flex components and postponing trying to use > > Sprites-based classes. You'll make more progress, gain confidence, and > > then be in a better position to understand how to take advantage of > > Sprites later. > > > > > ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ