RE: [flexcoders] Re: addChild doesn't effect for some reason REFdn2065133102

2009-10-30 Thread dennis
For god's sake. it works =) ! The button hasn't (at all) width and height!

 

What is the difference between the 

  addChild(buttonFromMainClass);

and 

  Application(Application.application).addChild(buttonFromMainClass);

In the adding process??? Does any body knows?

 

Thanks Amy anyway!!!

 

dennis

 



RE: [flexcoders] Re: addchild

2008-01-21 Thread Gordon Smith
 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Sunday, January 20, 2008 7:57 AM
To: flexcoders@yahoogroups.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
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
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-deta
il.html
http://livedocs.adobe.com/labs/flex3/langref/flash/display/package-deta
il.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_Vect
or_Graphics_5.html
http://livedocs.adobe.com/labs/flex3/html/help.html?content=Drawing_Vec
tor_Graphics_5.html 

var squareSize:uint = 100;
var square:Shape = new Shape();
square.graphics.beginFill(0xFF, 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(0xFF, 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.IUIComponent.

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:* flexcoders@yahoogroups.com
mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] 
 *On Behalf Of [EMAIL

Re: [flexcoders] Re: addchild

2008-01-21 Thread Sherif Abdou
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( 0xFF, 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( 0xFF, 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

Re: [flexcoders] Re: addchild

2008-01-21 Thread [EMAIL PROTECTED]


Gordon Smith wrote:

  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?







No it doesn't.You were correct, I just wondered how you would know.

Thanks for the explanations.I still don't understand why there's no 
example of drawing a shape in the flex documentation that doesn't use 
flash.* classes. I understand that the flash.* and sprite based examples 
can be children in a flex application, but you seem to be saying that 
shapes can be created without those classes.

If not, then maybe I misunderstood when you said to start with the flex 
classes. Maybe you were saying, in effect not to start with shapes.

It that correct ?










  
  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



RE: [flexcoders] Re: addchild

2008-01-21 Thread Gordon Smith
I think someone else already explained that you can simply draw into a
UIComponent rather than into a Sprite or a Shape. All three of these
have a 'graphics' property which contains a reference to an instance of
the flash.display.Graphics class, which has methods like drawCircle().
But a UIComponent will just work with Flex containers like VBox while
Sprite and Shape require you to do more work.
 
Here's the Flex Way to create a Ball component (in AS, but you could
also do it in MXML) that extends UIComponent, and then use it in an MXML
app:
 
Ball.as:
--
 
package
{
 
import flash.display.Graphics;
import mx.core.UIComponent;
 
public class Ball extends UIComponent
{
public function Ball()
{
super();
}
 
override protected function updateDisplayList(unscaledWidth:Number,
 
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);

var g:Graphics = graphics;
g.clear();
g.beginFill(0x00);
g.drawEllipse(0, 0, unscaledWidth, unscaledHeight);
g.endFill();
}
}
 
}

BallExample.mxml:
---
 
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
http://www.adobe.com/2006/mxml  xmlns:my=*
my:Ball width=100 height=100/
my:Ball width=200 height=200/
/mx:Application
 
You can see that Flex has its own ways of doing certain things that you
won't find in a book only about ActionScript. For example, you should do
all of your drawing in an override of the updateDisplayList() method, in
order to work properly with Flex's LayoutManager.
 
Now you're a Flex component developer! Next you could learn how to make
the ball have some size even if you don't specify 'width' and 'height'
in the mx:Ball tag. Or add a style to determine the ball's color using
CSS. Or add an event handler to change the color when the user clicks on
it. Or let your user create new Ball instances at runtime by doing
something. Or use effects to move the balls around. Or whatever...
 
As for whether there are examples like this somewhere in our docs... I
sure hope so! But I can't say for sure as I'm on the development team,
not the documentation team, and I haven't personally looked through an
entire documentation set, which is huge.
 
Gordon Smith
Adobe Flex SDK Team



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Monday, January 21, 2008 6:03 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: addchild





Gordon Smith wrote:

  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?

No it doesn't.You were correct, I just wondered how you would know.

Thanks for the explanations.I still don't understand why there's no 
example of drawing a shape in the flex documentation that doesn't use 
flash.* classes. I understand that the flash.* and sprite based examples

can be children in a flex application, but you seem to be saying that 
shapes can be created without those classes.

If not, then maybe I misunderstood when you said to start with the flex 
classes. Maybe you were saying, in effect not to start with shapes.

It that correct ?

 
  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



 


Re: [flexcoders] Re: addchild

2008-01-21 Thread [EMAIL PROTECTED]
Thanks for the example. Its just what I needed.

Gordon Smith wrote:

 I think someone else already explained that you can simply draw into a 
 UIComponent rather than into a Sprite or a Shape. All three of these 
 have a 'graphics' property which contains a reference to an instance 
 of the flash.display.Graphics class, which has methods 
 like drawCircle().  But a UIComponent will just work with Flex 
 containers like VBox while Sprite and Shape require you to do more work.
  
 Here's the Flex Way to create a Ball component (in AS, but you could 
 also do it in MXML) that extends UIComponent, and then use it in an 
 MXML app:
  
 Ball.as:
 --
  
 package
 {
  
 import flash.display.Graphics;
 import mx.core.UIComponent;
  
 public class Ball extends UIComponent
 {
 public function Ball()
 {
 super();
 }
  
 override protected function updateDisplayList(unscaledWidth:Number,
   unscaledHeight:Number):void
 {
 super.updateDisplayList(unscaledWidth, unscaledHeight);

 var g:Graphics = graphics;
 g.clear();
 g.beginFill(0x00);
 g.drawEllipse(0, 0, unscaledWidth, unscaledHeight);
 g.endFill();
 }
 }
  
 }
 BallExample.mxml:
 ---
  
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml 
 http://www.adobe.com/2006/mxml xmlns:my=*
 my:Ball width=100 height=100/
 my:Ball width=200 height=200/
 /mx:Application
  
 You can see that Flex has its own ways of doing certain things that 
 you won't find in a book only about ActionScript. For example, you 
 should do all of your drawing in an override of the 
 updateDisplayList() method, in order to work properly with Flex's 
 LayoutManager.
  
 Now you're a Flex component developer! Next you could learn how to 
 make the ball have some size even if you don't specify 'width' and 
 'height' in the mx:Ball tag. Or add a style to determine the ball's 
 color using CSS. Or add an event handler to change the color when the 
 user clicks on it. Or let your user create new Ball instances at 
 runtime by doing something. Or use effects to move the balls around. 
 Or whatever...
  
 As for whether there are examples like this somewhere in our docs... I 
 sure hope so! But I can't say for sure as I'm on the development team, 
 not the documentation team, and I haven't personally looked through an 
 entire documentation set, which is huge.
  
 Gordon Smith
 Adobe Flex SDK Team

 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of [EMAIL PROTECTED]
 *Sent:* Monday, January 21, 2008 6:03 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* Re: [flexcoders] Re: addchild



 Gordon Smith wrote:
 
   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?

 No it doesn't.You were correct, I just wondered how you would know.

 Thanks for the explanations.I still don't understand why there's no
 example of drawing a shape in the flex documentation that doesn't use
 flash.* classes. I understand that the flash.* and sprite based examples
 can be children in a flex application, but you seem to be saying that
 shapes can be created without those classes.

 If not, then maybe I misunderstood when you said to start with the flex
 classes. Maybe you were saying, in effect not to start with shapes.

 It that correct ?

 
   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


  



Re: [flexcoders] Re: addchild

2008-01-20 Thread [EMAIL PROTECTED]
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(0xFF, 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(0xFF, 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.IUIComponent.


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:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of [EMAIL PROTECTED]
 *Sent:* Thursday, January 17, 2008 11:37 PM
 *To:* flexcoders@yahoogroups.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

RE: [flexcoders] Re: addchild

2008-01-20 Thread Jim Hayes
What you need to do in flex is the following: (off top of head and not checked)

//make a new uicomponent
var uic:UIComponent = new UIComponent();

var squareSize:uint = 100;
var square:Shape = new Shape();
square.graphics.beginFill(0xFF, 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(0xFF, 0.5);
square.graphics.drawRect(400, 0, squareSize, squareSize);
square.graphics.endFill();

// add the shape to the uicomponents displaylist
uic.addChild(square);

//add the uicomponent to the flex displaylist

this.addChild(uic);

It drove me a bit mad too, when I first used flex!

If you wanted to, you could draw direct to the uicomponent's graphics instead, 
we had a conversation on this list in the past few days covering that (Jason 
Merrill and Alex Harui mainly, with the odd post from myself). You may 
encounter rather a lot of fun with resizing though, as you'll see if you read 
those posts...
(Drawn objects acting as children to components?)

hope that helps,

Jim.


-Original Message-
From: flexcoders@yahoogroups.com on behalf of [EMAIL PROTECTED]
Sent: Sun 20/01/2008 15:56
To: flexcoders@yahoogroups.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(0xFF, 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(0xFF, 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.IUIComponent.


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:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of [EMAIL PROTECTED]
 *Sent:* Thursday, January 17, 2008 11:37 PM
 *To:* flexcoders@yahoogroups.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

Re: [flexcoders] Re: addchild

2008-01-20 Thread [EMAIL PROTECTED]
Thanks, that helps alot.

Why isn't this in the documentation ?
http://livedocs.adobe.com/labs/flex3/html/help.html?content=Drawing_Vector_Graphics_6.html

It uses import flash.display.Shape;, not import mx.core.UIComponent;

Or if it is somewhere else, where is it ?


Here is the  simplest version I could come up with.
import mx.core.UIComponent;
public function makeSquare():void
{
//make a new uicomponent
var uic:UIComponent = new UIComponent();
uic.graphics.beginFill(0xFF, 0.5);
uic.graphics.drawRect(0, 0, 100, 100);
uic.graphics.endFill();

//add the uicomponent to the flex displaylist
this.addChild(uic);
}









Jim Hayes wrote:

 What you need to do in flex is the following: (off top of head and not 
 checked)

 //make a new uicomponent
 var uic:UIComponent = new UIComponent();

 var squareSize:uint = 100;
 var square:Shape = new Shape();
 square.graphics.beginFill(0xFF, 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(0xFF, 0.5);
 square.graphics.drawRect(400, 0, squareSize, squareSize);
 square.graphics.endFill();

 // add the shape to the uicomponents displaylist
 uic.addChild(square);

 //add the uicomponent to the flex displaylist

 this.addChild(uic);

 It drove me a bit mad too, when I first used flex!

 If you wanted to, you could draw direct to the uicomponent's graphics 
 instead, we had a conversation on this list in the past few days 
 covering that (Jason Merrill and Alex Harui mainly, with the odd post 
 from myself). You may encounter rather a lot of fun with resizing 
 though, as you'll see if you read those posts...
 (Drawn objects acting as children to components?)

 hope that helps,

 Jim.

 -Original Message-
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 on behalf of [EMAIL PROTECTED] mailto:info1%40reenie.org
 Sent: Sun 20/01/2008 15:56
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.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 
 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 
 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
  
 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
  
 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(0xFF, 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(0xFF, 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.IUIComponent.

 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

Re: [flexcoders] Re: addchild

2008-01-20 Thread Sherif Abdou
That is if you do an ActionScript Project instead of a FlexProject


- Original Message 
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Sunday, January 20, 2008 1:05:32 PM
Subject: Re: [flexcoders] Re: addchild

Thanks, that helps alot.

Why isn't this in the documentation ?
http://livedocs. adobe.com/ labs/flex3/ html/help. html?content= 
Drawing_Vector_ Graphics_ 6.html

It uses import flash.display. Shape;, not import mx.core.UIComponent ;

Or if it is somewhere else, where is it ?

Here is the simplest version I could come up with.
import mx.core.UIComponent ;
public function makeSquare() :void
{
//make a new uicomponent
var uic:UIComponent = new UIComponent( );
uic.graphics. beginFill( 0xFF, 0.5);
uic.graphics. drawRect( 0, 0, 100, 100);
uic.graphics. endFill() ;

//add the uicomponent to the flex displaylist
this.addChild( uic);
}

Jim Hayes wrote:

 What you need to do in flex is the following: (off top of head and not 
 checked)

 //make a new uicomponent
 var uic:UIComponent = new UIComponent( );

 var squareSize:uint = 100;
 var square:Shape = new Shape();
 square.graphics. beginFill( 0xFF, 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( 0xFF, 0.5);
 square.graphics. drawRect( 400, 0, squareSize, squareSize);
 square.graphics. endFill() ;

 // add the shape to the uicomponents displaylist
 uic.addChild( square);

 //add the uicomponent to the flex displaylist

 this.addChild( uic);

 It drove me a bit mad too, when I first used flex!

 If you wanted to, you could draw direct to the uicomponent' s graphics 
 instead, we had a conversation on this list in the past few days 
 covering that (Jason Merrill and Alex Harui mainly, with the odd post 
 from myself). You may encounter rather a lot of fun with resizing 
 though, as you'll see if you read those posts...
 (Drawn objects acting as children to components?)

 hope that helps,

 Jim.

 -Original Message-
 From: [EMAIL PROTECTED] ups.com mailto:flexcoders% 40yahoogroups. com 
 on behalf of [EMAIL PROTECTED] org mailto:info1% 40reenie. org
 Sent: Sun 20/01/2008 15:56
 To: [EMAIL PROTECTED] ups.com mailto:flexcoders% 40yahoogroups. 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 
 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 
 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 
 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 
 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( 0xFF, 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( 0xFF, 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

Re: [flexcoders] Re: addchild

2008-01-20 Thread [EMAIL PROTECTED]
Yes I know, but where is the documentation for a flex project ?

Sherif Abdou wrote:
 That is if you do an ActionScript Project instead of a FlexProject

 - Original Message 
 From: [EMAIL PROTECTED] [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Sunday, January 20, 2008 1:05:32 PM
 Subject: Re: [flexcoders] Re: addchild

 Thanks, that helps alot.

 Why isn't this in the documentation ?
 http://livedocs. adobe.com/ labs/flex3/ html/help. html?content= 
 Drawing_Vector_ Graphics_ 6.html 
 http://livedocs.adobe.com/labs/flex3/html/help.html?content=Drawing_Vector_Graphics_6.html

 It uses import flash.display. Shape;, not import mx.core.UIComponent ;

 Or if it is somewhere else, where is it ?

 Here is the simplest version I could come up with.
 import mx.core.UIComponent ;
 public function makeSquare() :void
 {
 //make a new uicomponent
 var uic:UIComponent = new UIComponent( );
 uic.graphics. beginFill( 0xFF, 0.5);
 uic.graphics. drawRect( 0, 0, 100, 100);
 uic.graphics. endFill() ;

 //add the uicomponent to the flex displaylist
 this.addChild( uic);
 }

 Jim Hayes wrote:
 
  What you need to do in flex is the following: (off top of head and not
  checked)
 
  //make a new uicomponent
  var uic:UIComponent = new UIComponent( );
 
  var squareSize:uint = 100;
  var square:Shape = new Shape();
  square.graphics. beginFill( 0xFF, 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( 0xFF, 0.5);
  square.graphics. drawRect( 400, 0, squareSize, squareSize);
  square.graphics. endFill() ;
 
  // add the shape to the uicomponents displaylist
  uic.addChild( square);
 
  //add the uicomponent to the flex displaylist
 
  this.addChild( uic);
 
  It drove me a bit mad too, when I first used flex!
 
  If you wanted to, you could draw direct to the uicomponent' s graphics
  instead, we had a conversation on this list in the past few days
  covering that (Jason Merrill and Alex Harui mainly, with the odd post
  from myself). You may encounter rather a lot of fun with resizing
  though, as you'll see if you read those posts...
  (Drawn objects acting as children to components?)
 
  hope that helps,
 
  Jim.
 
  -Original Message-
  From: [EMAIL PROTECTED] ups.com 
 mailto:flexcoders%40yahoogroups.com mailto:flexcoders% 
 40yahoogroups. com
  on behalf of [EMAIL PROTECTED] org mailto:info1%40reenie.org 
 mailto:info1% 40reenie. org
  Sent: Sun 20/01/2008 15:56
  To: [EMAIL PROTECTED] ups.com 
 mailto:flexcoders%40yahoogroups.com mailto:flexcoders% 
 40yahoogroups. 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 
 http://livedocs.adobe.com/labs/flex3/langref/mx/graphics/package-detail.html
  

  http://livedocs. adobe.com/ labs/flex3/ langref/mx/ graphics/ 
 package-detail. html 
 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 
 http://livedocs.adobe.com/labs/flex3/langref/mx/graphics/Stroke.html
  http://livedocs. adobe.com/ labs/flex3/ langref/mx/ graphics/ 
 Stroke.html 
 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 
 http://livedocs.adobe.com/labs/flex3/langref/flash/display/package-detail.html
  

  http://livedocs. adobe.com/ labs/flex3/ langref/flash/ 
 display/package- detail.html 
 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 
 http://livedocs.adobe.com/labs/flex3/html/help.html?content=Drawing_Vector_Graphics_5.html
  

  http://livedocs. adobe.com/ labs/flex3/ html/help. html?content= 
 Drawing_Vector_ Graphics_ 5.html 
 http

RE: [flexcoders] Re: addchild

2008-01-20 Thread Jim Hayes
I can only guess that it's assumed that if you're doing a flex project, then 
you're going to be using either a standard component, an extension of one, or a 
completely custom one. 

In that case, you'd be inside that component as it were (eg writing code in a 
component that extended UIComponent), whereupon it would work as in the docs. 
(again, check Jason's recent posts, it's a reasonable example of that sort of 
thing).

It's a point of view thing really, but now I know flex a little I know that 
drawing stuff directly to the stage doesn't really fit in with the model all 
that well. You'd have to write a whole lot of routines to handle resizing of 
the app, or laying things around the drawing, dealing with z-orders etc.
All of which is kind of the point of using the flex framework (e.g. it does all 
that for you, assuming you code to it's guidelines).

I do understand where you're coming from though, I found much the same 
frustration/confusion when I first came from flash to flex, it took me a little 
while to get my head round it (and I still get a few nasty reminders that I 
don't know everything yet, by far ;)).

But if you persevere with it, I hope you'll find that it pays of quite rapidly. 
It did for me.


-Original Message-
From: flexcoders@yahoogroups.com on behalf of [EMAIL PROTECTED]
Sent: Sun 20/01/2008 21:20
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: addchild
 
Yes I know, but where is the documentation for a flex project ?

Sherif Abdou wrote:
 That is if you do an ActionScript Project instead of a FlexProject

 - Original Message 
 From: [EMAIL PROTECTED] [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Sunday, January 20, 2008 1:05:32 PM
 Subject: Re: [flexcoders] Re: addchild

 Thanks, that helps alot.

 Why isn't this in the documentation ?
 http://livedocs. adobe.com/ labs/flex3/ html/help. html?content= 
 Drawing_Vector_ Graphics_ 6.html 
 http://livedocs.adobe.com/labs/flex3/html/help.html?content=Drawing_Vector_Graphics_6.html

 It uses import flash.display. Shape;, not import mx.core.UIComponent ;

 Or if it is somewhere else, where is it ?

 Here is the simplest version I could come up with.
 import mx.core.UIComponent ;
 public function makeSquare() :void
 {
 //make a new uicomponent
 var uic:UIComponent = new UIComponent( );
 uic.graphics. beginFill( 0xFF, 0.5);
 uic.graphics. drawRect( 0, 0, 100, 100);
 uic.graphics. endFill() ;

 //add the uicomponent to the flex displaylist
 this.addChild( uic);
 }

 Jim Hayes wrote:
 
  What you need to do in flex is the following: (off top of head and not
  checked)
 
  //make a new uicomponent
  var uic:UIComponent = new UIComponent( );
 
  var squareSize:uint = 100;
  var square:Shape = new Shape();
  square.graphics. beginFill( 0xFF, 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( 0xFF, 0.5);
  square.graphics. drawRect( 400, 0, squareSize, squareSize);
  square.graphics. endFill() ;
 
  // add the shape to the uicomponents displaylist
  uic.addChild( square);
 
  //add the uicomponent to the flex displaylist
 
  this.addChild( uic);
 
  It drove me a bit mad too, when I first used flex!
 
  If you wanted to, you could draw direct to the uicomponent' s graphics
  instead, we had a conversation on this list in the past few days
  covering that (Jason Merrill and Alex Harui mainly, with the odd post
  from myself). You may encounter rather a lot of fun with resizing
  though, as you'll see if you read those posts...
  (Drawn objects acting as children to components?)
 
  hope that helps,
 
  Jim.
 
  -Original Message-
  From: [EMAIL PROTECTED] ups.com 
 mailto:flexcoders%40yahoogroups.com mailto:flexcoders% 
 40yahoogroups. com
  on behalf of [EMAIL PROTECTED] org mailto:info1%40reenie.org 
 mailto:info1% 40reenie. org
  Sent: Sun 20/01/2008 15:56
  To: [EMAIL PROTECTED] ups.com 
 mailto:flexcoders%40yahoogroups.com mailto:flexcoders% 
 40yahoogroups. 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 
 http://livedocs.adobe.com/labs/flex3/langref/mx/graphics/package-detail.html
  

  http://livedocs. adobe.com/ labs/flex3/ langref/mx/ graphics/ 
 package

Re: [flexcoders] Re: addchild

2008-01-19 Thread [EMAIL PROTECTED]
Now I'm really confused. How do I make a ball  using standard Flex 
components ? Everything I've seen uses a sprite.
Where can I find complete Flex examples that use standard Flex 
components   ?


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.
  
 Gordon Smith
 Adobe Flex SDK Team

 
 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
 *On Behalf Of *rueter007
 *Sent:* Thursday, January 17, 2008 10:12 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Re: addchild

 you cannot add sprites directly that way. you can do the following.

 var ballParent: UIComponent = new UIComponent();
 ballParent.addChild(ball);
 vbox.addChild(ballParent);

 and ofcourse, you have to set the width, height etc.

 - venkat
 http://www.venkatj.com http://www.venkatj.com

 --- In flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com, [EMAIL PROTECTED] [EMAIL 
 PROTECTED] wrote:
 
  This is the entire ball class
  package com.oreilly.programmingflex.states {
 
 
  import flash.display.Sprite;
 
  public class Ball extends Sprite {
  private var radius:Number;
  private var color:uint;
 
  public function Ball(radius:Number=40, color:uint=0xff) {
  this.radius = radius;
  this.color = color;
  init();
  }
  public function init():void {
  graphics.beginFill(color);
  graphics.drawCircle(0, 0, radius);
  graphics.endFill();
 
  }
  }
 
 
  }
 
 
  Sherif Abdou wrote:
   it means that the ball is not a IUIcomponenet which it is required
 for
   it to be added on stage, show me a bit of the ball class code so i
 can
   know
  
   - Original Message 
   From: [EMAIL PROTECTED] [EMAIL PROTECTED]
   To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
   Sent: Thursday, January 17, 2008 11:38:26 PM
   Subject: Re: [flexcoders] addchild
  
   OK thanks. Now when I try to use addChild, I get this error. What does
   it mean ?
   myball=new Ball;
   addChild(myball) ;
   TypeError: Error #1034: Type Coercion failed: cannot convert
   com.oreilly. programmingflex. states::Ball@ 5787299 to
   mx.core.IUIComponen t.
   at
   mx.core::Container/http://www.adobe. com/2006/ flex/mx/internal
   ::addingChild
 http://www.adobe.com/2006/flex/mx/internal::addingChild 
 http://www.adobe.com/2006/flex/mx/internal::addingChild()
   at mx.core::Container/ addChildAt( )
   at mx.core::Container/ addChild( )
   at Main/::initializeHa ndler()
   at Main/___Application 1_initialize( )
   at
   flash.events: :EventDispatcher /flash.events: EventDispatcher:
   :dispatchEventFu nction()
   at flash.events: :EventDispatcher /dispatchEvent( )
   at mx.core::UIComponen t/dispatchEvent( )
   at mx.core::UIComponen t/set processedDescriptor s()
   at mx.core::Container/ createComponents FromDescriptors( )
  
   Sherif Abdou wrote:
addChild not addchild
   
- Original Message 
From: [EMAIL PROTECTED] org mailto:info1%40reenie.org
 [EMAIL PROTECTED]
   org mailto:info1%40reenie.org
To: [EMAIL 

RE: [flexcoders] Re: addchild

2008-01-18 Thread Merrill, Jason
This may help:
 
http://weblogs.thekeunster.com/?p=6
 
 

Jason Merrill 
Bank of America 
GTO LLD Solutions Design  Development 
eTools  Multimedia 

Bank of America Flash Platform Developer Community 





Re: [flexcoders] Re: addchild

2008-01-17 Thread [EMAIL PROTECTED]
Ok thanks, I tried that, Now I get this error,
Type was not found or was not a compile-time constant: UIComponent.

rueter007 wrote:

 you cannot add sprites directly that way. you can do the following.

 var ballParent: UIComponent = new UIComponent();
 ballParent.addChild(ball);
 vbox.addChild(ballParent);

 and ofcourse, you have to set the width, height etc.

 - venkat
 http://www.venkatj.com http://www.venkatj.com

 --- In flexcoders@yahoogroups.com 
 mailto:flexcoders%40yahoogroups.com, [EMAIL PROTECTED] [EMAIL 
 PROTECTED] wrote:
 
  This is the entire ball class
  package com.oreilly.programmingflex.states {
 
 
  import flash.display.Sprite;
 
  public class Ball extends Sprite {
  private var radius:Number;
  private var color:uint;
 
  public function Ball(radius:Number=40, color:uint=0xff) {
  this.radius = radius;
  this.color = color;
  init();
  }
  public function init():void {
  graphics.beginFill(color);
  graphics.drawCircle(0, 0, radius);
  graphics.endFill();
 
  }
  }
 
 
  }
 
 
  Sherif Abdou wrote:
   it means that the ball is not a IUIcomponenet which it is required
 for
   it to be added on stage, show me a bit of the ball class code so i
 can
   know
  
   - Original Message 
   From: [EMAIL PROTECTED] [EMAIL PROTECTED]
   To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
   Sent: Thursday, January 17, 2008 11:38:26 PM
   Subject: Re: [flexcoders] addchild
  
   OK thanks. Now when I try to use addChild, I get this error. What does
   it mean ?
   myball=new Ball;
   addChild(myball) ;
   TypeError: Error #1034: Type Coercion failed: cannot convert
   com.oreilly. programmingflex. states::Ball@ 5787299 to
   mx.core.IUIComponen t.
   at
   mx.core::Container/http://www.adobe. com/2006/ flex/mx/internal
   ::addingChild
 http://www.adobe.com/2006/flex/mx/internal::addingChild 
 http://www.adobe.com/2006/flex/mx/internal::addingChild()
   at mx.core::Container/ addChildAt( )
   at mx.core::Container/ addChild( )
   at Main/::initializeHa ndler()
   at Main/___Application 1_initialize( )
   at
   flash.events: :EventDispatcher /flash.events: EventDispatcher:
   :dispatchEventFu nction()
   at flash.events: :EventDispatcher /dispatchEvent( )
   at mx.core::UIComponen t/dispatchEvent( )
   at mx.core::UIComponen t/set processedDescriptor s()
   at mx.core::Container/ createComponents FromDescriptors( )
  
   Sherif Abdou wrote:
addChild not addchild
   
- Original Message 
From: [EMAIL PROTECTED] org mailto:info1%40reenie.org
 [EMAIL PROTECTED]
   org mailto:info1%40reenie.org
To: [EMAIL PROTECTED] ups.com
 mailto:flexcoders%40yahoogroups.com
Sent: Thursday, January 17, 2008 11:03:15 PM
Subject: [flexcoders] addchild
   
I have a ball class. I can make a ball. How do I add it to the
 stage ?
   
I have seem plenty of examples, and they use addchild.
Every time I try to use addchild, I get this error:
Error: Call to a possibly undefined method addChild.
   
or if I try to attach it to an existing element
such as mx:VBox id=vbox
vbox.addchild( ball);
I get :Error: Access of undefined property vbox.
   
So what can I put addchild on ?
   
   
   
 - - - - - -
Never miss a thing. Make Yahoo your homepage.
http://us.rd. yahoo.com/ evt=51438/ *http://www. yahoo.com/ r/hs
   http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs 
 http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs
   
  
  
  
  
 --
   Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
 Try
   it now.
  
 http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ%20
  
 http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ%20

  
  
 

  



Re: [flexcoders] Re: addchild

2008-01-17 Thread Max Frigge
import mx.core.UIComponent;

- Original Message 
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Friday, January 18, 2008 5:28:02 PM
Subject: Re: [flexcoders] Re: addchild










  



Ok thanks, I tried that, Now I get this error,

Type was not found or was not a compile-time constant: UIComponent.



rueter007 wrote:



 you cannot add sprites directly that way. you can do the following.



 var ballParent: UIComponent = new UIComponent( );

 ballParent.addChild (ball);

 vbox.addChild( ballParent) ;



 and ofcourse, you have to set the width, height etc.



 - venkat

 http://www.venkatj. com http://www.venkatj. com



 --- In [EMAIL PROTECTED] ups.com 

 mailto:flexcoders% 40yahoogroups. com, [EMAIL PROTECTED] [EMAIL 
 PROTECTED] wrote:

 

  This is the entire ball class

  package com.oreilly. programmingflex. states {

 

 

  import flash.display. Sprite;

 

  public class Ball extends Sprite {

  private var radius:Number;

  private var color:uint;

 

  public function Ball(radius: Number=40, color:uint=0xff ) {

  this.radius = radius;

  this.color = color;

  init();

  }

  public function init():void {

  graphics.beginFill( color);

  graphics.drawCircle (0, 0, radius);

  graphics.endFill( );

 

  }

  }

 

 

  }

 

 

  Sherif Abdou wrote:

   it means that the ball is not a IUIcomponenet which it is required

 for

   it to be added on stage, show me a bit of the ball class code so i

 can

   know

  

   - Original Message 

   From: [EMAIL PROTECTED] [EMAIL PROTECTED]

   To: [EMAIL PROTECTED] ups.com mailto:flexcoders% 40yahoogroups. com

   Sent: Thursday, January 17, 2008 11:38:26 PM

   Subject: Re: [flexcoders] addchild

  

   OK thanks. Now when I try to use addChild, I get this error. What does

   it mean ?

   myball=new Ball;

   addChild(myball) ;

   TypeError: Error #1034: Type Coercion failed: cannot convert

   com.oreilly. programmingflex. states::Ball@ 5787299 to

   mx.core.IUIComponen t.

   at

   mx.core::Container/http://www.adobe. com/2006/ flex/mx/internal

   ::addingChild

 http://www.adobe. com/2006/ flex/mx/internal ::addingChild 

 http://www.adobe. com/2006/ flex/mx/internal ::addingChild()

   at mx.core::Container/ addChildAt( )

   at mx.core::Container/ addChild( )

   at Main/::initializeHa ndler()

   at Main/___Application 1_initialize( )

   at

   flash.events: :EventDispatcher /flash.events: EventDispatcher:

   :dispatchEventFu nction()

   at flash.events: :EventDispatcher /dispatchEvent( )

   at mx.core::UIComponen t/dispatchEvent( )

   at mx.core::UIComponen t/set processedDescriptor s()

   at mx.core::Container/ createComponents FromDescriptors( )

  

   Sherif Abdou wrote:

addChild not addchild

   

- Original Message 

From: [EMAIL PROTECTED] org mailto:info1% 40reenie. org

 [EMAIL PROTECTED]

   org mailto:info1% 40reenie. org

To: [EMAIL PROTECTED] ups.com

 mailto:flexcoders% 40yahoogroups. com

Sent: Thursday, January 17, 2008 11:03:15 PM

Subject: [flexcoders] addchild

   

I have a ball class. I can make a ball. How do I add it to the

 stage ?

   

I have seem plenty of examples, and they use addchild.

Every time I try to use addchild, I get this error:

Error: Call to a possibly undefined method addChild.

   

or if I try to attach it to an existing element

such as mx:VBox id=vbox

vbox.addchild( ball);

I get :Error: Access of undefined property vbox.

   

So what can I put addchild on ?

   

   

   

 - - - - - -

Never miss a thing. Make Yahoo your homepage.

http://us.rd. yahoo.com/ evt=51438/ *http://www. yahoo.com/ r/hs

   http://us.rd. yahoo.com/ evt=51438/ *http://www. yahoo.com/ r/hs 

 http://us.rd. yahoo.com/ evt=51438/ *http://www. yahoo.com/ r/hs

   

  

  

  

  

  - - - - - -

   Be a better friend, newshound, and know-it-all with Yahoo! Mobile.

 Try

   it now.

  

 http://us.rd. yahoo.com/ evt=51733/ *http://mobile. yahoo.com/ 
 ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ%20 

 http://us.rd. yahoo.com/ evt=51733/ *http://mobile. yahoo.com/ 
 ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ%20



  

  

 



  






  







!--

#ygrp-mkp{
border:1px solid #d8d8d8;font-family:Arial;margin:14px 0px;padding:0px 14px;}
#ygrp-mkp hr{
border:1px solid #d8d8d8;}
#ygrp-mkp #hd{
color:#628c2a;font-size:85%;font-weight:bold;line-height:122%;margin:10px 0px;}
#ygrp-mkp #ads{
margin-bottom:10px;}
#ygrp-mkp .ad{
padding:0 0;}
#ygrp-mkp .ad a{
color:#ff;text-decoration:none;}
--



!--

#ygrp-sponsor #ygrp-lc{
font-family:Arial;}
#ygrp-sponsor #ygrp-lc #hd{
margin:10px 0px;font-weight:bold;font-size:78%;line-height:122%;}
#ygrp-sponsor #ygrp-lc .ad{
margin-bottom:10px;padding:0 0;}
--



!--

#ygrp-mlmsg {font-size:13px;font-family:arial

Re: [flexcoders] Re: addchild

2008-01-17 Thread [EMAIL PROTECTED]
Ok thanks, I can finally see the ball.
I did look on
http://livedocs.adobe.com/flex/2/langref/mx/core/UIComponent.html
It should have this line somewhere on this page:
import.mx.core.UIComponent
For the world of me I don't know why they don't have that on that page.




Max Frigge wrote:
 import mx.core.UIComponent;

 - Original Message 
 From: [EMAIL PROTECTED] [EMAIL PROTECTED]
 To: flexcoders@yahoogroups.com
 Sent: Friday, January 18, 2008 5:28:02 PM
 Subject: Re: [flexcoders] Re: addchild

 Ok thanks, I tried that, Now I get this error,
 Type was not found or was not a compile-time constant: UIComponent.

 rueter007 wrote:
 
  you cannot add sprites directly that way. you can do the following.
 
  var ballParent: UIComponent = new UIComponent( );
  ballParent.addChild (ball);
  vbox.addChild( ballParent) ;
 
  and ofcourse, you have to set the width, height etc.
 
  - venkat
  http://www.venkatj. com http://www.venkatj.com 
 http://www.venkatj. com http://www.venkatj.com
 
  --- In [EMAIL PROTECTED] ups.com 
 mailto:flexcoders%40yahoogroups.com
  mailto:flexcoders% 40yahoogroups. com, [EMAIL PROTECTED] [EMAIL 
  PROTECTED] wrote:
  
   This is the entire ball class
   package com.oreilly. programmingflex. states {
  
  
   import flash.display. Sprite;
  
   public class Ball extends Sprite {
   private var radius:Number;
   private var color:uint;
  
   public function Ball(radius: Number=40, color:uint=0xff ) {
   this.radius = radius;
   this.color = color;
   init();
   }
   public function init():void {
   graphics.beginFill( color);
   graphics.drawCircle (0, 0, radius);
   graphics.endFill( );
  
   }
   }
  
  
   }
  
  
   Sherif Abdou wrote:
it means that the ball is not a IUIcomponenet which it is required
  for
it to be added on stage, show me a bit of the ball class code so i
  can
know
   
- Original Message 
From: [EMAIL PROTECTED] [EMAIL PROTECTED]
To: [EMAIL PROTECTED] ups.com 
 mailto:flexcoders%40yahoogroups.com mailto:flexcoders% 
 40yahoogroups. com
Sent: Thursday, January 17, 2008 11:38:26 PM
Subject: Re: [flexcoders] addchild
   
OK thanks. Now when I try to use addChild, I get this error. 
 What does
it mean ?
myball=new Ball;
addChild(myball) ;
TypeError: Error #1034: Type Coercion failed: cannot convert
com.oreilly. programmingflex. states::Ball@ 5787299 to
mx.core.IUIComponen t.
at
mx.core::Container/http://www.adobe. com/2006/ flex/mx/internal
::addingChild
  http://www.adobe. com/2006/ flex/mx/internal ::addingChild 
 http://www.adobe.com/2006/flex/mx/internal::addingChild
  http://www.adobe. com/2006/ flex/mx/internal ::addingChild 
 http://www.adobe.com/2006/flex/mx/internal::addingChild()
at mx.core::Container/ addChildAt( )
at mx.core::Container/ addChild( )
at Main/::initializeHa ndler()
at Main/___Application 1_initialize( )
at
flash.events: :EventDispatcher /flash.events: EventDispatcher:
:dispatchEventFu nction()
at flash.events: :EventDispatcher /dispatchEvent( )
at mx.core::UIComponen t/dispatchEvent( )
at mx.core::UIComponen t/set processedDescriptor s()
at mx.core::Container/ createComponents FromDescriptors( )
   
Sherif Abdou wrote:
 addChild not addchild

 - Original Message 
 From: [EMAIL PROTECTED] org mailto:info1% 40reenie. org
  [EMAIL PROTECTED]
org mailto:info1% 40reenie. org
 To: [EMAIL PROTECTED] ups.com http://ups.com
  mailto:flexcoders% 40yahoogroups. com
 Sent: Thursday, January 17, 2008 11:03:15 PM
 Subject: [flexcoders] addchild

 I have a ball class. I can make a ball. How do I add it to the
  stage ?

 I have seem plenty of examples, and they use addchild.
 Every time I try to use addchild, I get this error:
 Error: Call to a possibly undefined method addChild.

 or if I try to attach it to an existing element
 such as mx:VBox id=vbox
 vbox.addchild( ball);
 I get :Error: Access of undefined property vbox.

 So what can I put addchild on ?



  - - - - - -
 Never miss a thing. Make Yahoo your homepage.
 http://us.rd. yahoo.com/ http://yahoo.com/ evt=51438/ 
 *http://www. yahoo.com/ r http://yahoo.com//hs
http://us.rd. yahoo.com/ evt=51438/ *http://www. yahoo.com/ 
 r/hs http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs
  http://us.rd. yahoo.com/ evt=51438/ *http://www. yahoo.com/ r/hs 
 http://us.rd.yahoo.com/evt=51438/*http://www.yahoo.com/r/hs

   
   
   
   
   - - - - - -
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.
  Try
it now.
   
  http://us.rd. yahoo.com/ evt=51733/ *http://mobile. yahoo.com/ 
 ;_ylt=Ahu06i62sR 8HDtDypao8Wcj9tA cJ%20 
 http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ%20

RE: [flexcoders] Re: addchild

2008-01-17 Thread Gordon Smith
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.
 
Gordon Smith
Adobe Flex SDK Team



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of rueter007
Sent: Thursday, January 17, 2008 10:12 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: addchild



you cannot add sprites directly that way. you can do the following.

var ballParent: UIComponent = new UIComponent();
ballParent.addChild(ball);
vbox.addChild(ballParent);

and ofcourse, you have to set the width, height etc.

- venkat
http://www.venkatj.com http://www.venkatj.com 

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 This is the entire ball class
 package com.oreilly.programmingflex.states {
 
 
 import flash.display.Sprite;
 
 public class Ball extends Sprite {
 private var radius:Number;
 private var color:uint;
 
 public function Ball(radius:Number=40, color:uint=0xff) {
 this.radius = radius;
 this.color = color;
 init();
 }
 public function init():void {
 graphics.beginFill(color);
 graphics.drawCircle(0, 0, radius);
 graphics.endFill();
 
 }
 }
 
 
 }
 
 
 Sherif Abdou wrote:
  it means that the ball is not a IUIcomponenet which it is required
for 
  it to be added on stage, show me a bit of the ball class code so i
can 
  know
 
  - Original Message 
  From: [EMAIL PROTECTED] [EMAIL PROTECTED]
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com

  Sent: Thursday, January 17, 2008 11:38:26 PM
  Subject: Re: [flexcoders] addchild
 
  OK thanks. Now when I try to use addChild, I get this error. What
does
  it mean ?
  myball=new Ball;
  addChild(myball) ;
  TypeError: Error #1034: Type Coercion failed: cannot convert
  com.oreilly. programmingflex. states::Ball@ 5787299 to 
  mx.core.IUIComponen t.
  at
  mx.core::Container/http://www.adobe. com/2006/ flex/mx/internal 
  ::addingChild
http://www.adobe.com/2006/flex/mx/internal::addingChild
http://www.adobe.com/2006/flex/mx/internal::addingChild ()
  at mx.core::Container/ addChildAt( )
  at mx.core::Container/ addChild( )
  at Main/::initializeHa ndler()
  at Main/___Application 1_initialize( )
  at
  flash.events: :EventDispatcher /flash.events: EventDispatcher: 
  :dispatchEventFu nction()
  at flash.events: :EventDispatcher /dispatchEvent( )
  at mx.core::UIComponen t/dispatchEvent( )
  at mx.core::UIComponen t/set processedDescriptor s()
  at mx.core::Container/ createComponents FromDescriptors( )
 
  Sherif Abdou wrote:
   addChild not addchild
  
   - Original Message 
   From: [EMAIL PROTECTED] org mailto:info1%40reenie.org
[EMAIL PROTECTED] 
  org mailto:info1%40reenie.org
   To: [EMAIL PROTECTED] ups.com
mailto:flexcoders%40yahoogroups.com
   Sent: Thursday, January 17, 2008 11:03:15 PM
   Subject: [flexcoders] addchild
  
   I have a ball class. I can make a ball. How do I add it to the
stage ?
  
   I have seem plenty of examples, and they use addchild.
   Every time I try to use addchild, I get this error:
   Error: Call to a possibly undefined method addChild.
  
   or if I try to 

RE: [flexcoders] Re: addchild

2008-01-17 Thread Gordon Smith
 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Thursday, January 17, 2008 11:37 PM
To: flexcoders@yahoogroups.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.

 


 


Re: [flexcoders] Re: addchild

2008-01-17 Thread [EMAIL PROTECTED]
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.



  


RE: [flexcoders] Re: addChild creationCompleteEffect

2007-10-18 Thread Joan Lafferty
Maybe try your effect on the showEffect rather than the
creationCompleteEffect? I haven't tried this to see if it works... just
a suggestion.

 

Joan

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of johantrax
Sent: Thursday, October 18, 2007 8:16 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: addChild  creationCompleteEffect

 

Nobody with any tips? :(

--Johan

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, johantrax [EMAIL PROTECTED]
wrote:

 Hi all,
 
 I create a TitleWindow with the PopupManager. The titlewindow should
 dynamically contain a canvas.
 So how did I do that. I gave the titlewindow a property called
 'contentForm' which contains a canvas. Then in the
 creationComplete-event of the titlewindow, addChild(contentForm) is
 called for adding the canvas to the titlewindow.
 So far, so good...
 
 Next I wanted to create some popup/popout effect on the titlewindow.
 So I set creationCompleteEffect to 'popup', a mx:Parallel of
 zoom/move/fade. I also set the removedEffect to 'popout', a
mx:Sequence.
 
 What's the problem? The 'popup'-effect should move the titlewindow
 from the top to the center of the application. I figured this move-tag
 would give me what needed:
 mx:Move
 yFrom={-this.height} yTo={(Application.application.height -
 this.height) / 2}
 xFrom={Application.application.width / 2}
 xTo={(Application.application.width - this.width) / 2}
 /
 However, this isn't working as expected.
 The only logical explanation I can come up with is the following:
 creationComplete and creationCompleteEffect both get executed when the
 creationcomplete-Event is fired. Since the childComponent is only
 added during the handling of that event, the effect playing is not yet
 aware of the change in size.
 
 This lead me into the FlexDocs, where I learned that adding children
 should be part of the initialisationEvent.
 So I assigned my init()method to the initialize-listener instead of
 creationComplete.
 However, this is giving me the following errors:
 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.
 at mx.containers::Panel/::showTitleBar()
 at mx.containers::Panel/mx.containers:Panel::layoutChrome()
 at mx.core::Container/mx.core:Container::updateDisplayList()
 ...
 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.
 at components::PopupFormWindow/::init()
 at components::PopupFormWindow/___TitleWindow1_initialize()
 at

flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
 ...
 
 My init-method is as follows:
 private function init():void {
 //create inner form
 contentForm.currentState = this.currentState;
 (contentForm as customerPopupForm).ac = this.ac;
 this.addChild(contentForm);
 }
 
 Any help, push in the right direction is really appreciated. I will
 provide the full errormsgs/more code if needed, but I consider this to
 be a long post already ;)
 --Johan


 



RE: [flexcoders] Re: addChild creationCompleteEffect

2007-10-18 Thread Joan Lafferty
One more suggestion to try. You can listen for the childAdd event on the
TitleWindow. Then, in the event handler, play the effect on the Canvas.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Joan Lafferty
Sent: Thursday, October 18, 2007 10:06 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Re: addChild  creationCompleteEffect

 

Maybe try your effect on the showEffect rather than the
creationCompleteEffect? I haven't tried this to see if it works... just
a suggestion.

 

Joan

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of johantrax
Sent: Thursday, October 18, 2007 8:16 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: addChild  creationCompleteEffect

 

Nobody with any tips? :(

--Johan

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, johantrax [EMAIL PROTECTED]
wrote:

 Hi all,
 
 I create a TitleWindow with the PopupManager. The titlewindow should
 dynamically contain a canvas.
 So how did I do that. I gave the titlewindow a property called
 'contentForm' which contains a canvas. Then in the
 creationComplete-event of the titlewindow, addChild(contentForm) is
 called for adding the canvas to the titlewindow.
 So far, so good...
 
 Next I wanted to create some popup/popout effect on the titlewindow.
 So I set creationCompleteEffect to 'popup', a mx:Parallel of
 zoom/move/fade. I also set the removedEffect to 'popout', a
mx:Sequence.
 
 What's the problem? The 'popup'-effect should move the titlewindow
 from the top to the center of the application. I figured this move-tag
 would give me what needed:
 mx:Move
 yFrom={-this.height} yTo={(Application.application.height -
 this.height) / 2}
 xFrom={Application.application.width / 2}
 xTo={(Application.application.width - this.width) / 2}
 /
 However, this isn't working as expected.
 The only logical explanation I can come up with is the following:
 creationComplete and creationCompleteEffect both get executed when the
 creationcomplete-Event is fired. Since the childComponent is only
 added during the handling of that event, the effect playing is not yet
 aware of the change in size.
 
 This lead me into the FlexDocs, where I learned that adding children
 should be part of the initialisationEvent.
 So I assigned my init()method to the initialize-listener instead of
 creationComplete.
 However, this is giving me the following errors:
 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.
 at mx.containers::Panel/::showTitleBar()
 at mx.containers::Panel/mx.containers:Panel::layoutChrome()
 at mx.core::Container/mx.core:Container::updateDisplayList()
 ...
 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.
 at components::PopupFormWindow/::init()
 at components::PopupFormWindow/___TitleWindow1_initialize()
 at

flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEven
tFunction()
 ...
 
 My init-method is as follows:
 private function init():void {
 //create inner form
 contentForm.currentState = this.currentState;
 (contentForm as customerPopupForm).ac = this.ac;
 this.addChild(contentForm);
 }
 
 Any help, push in the right direction is really appreciated. I will
 provide the full errormsgs/more code if needed, but I consider this to
 be a long post already ;)
 --Johan


 



RE: [flexcoders] Re: addchild error

2007-03-28 Thread Alex Harui
Ok, but why would you want to add the same view twice?  Do you want to add two 
different instances?



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of wifi19
Sent: Wednesday, March 28, 2007 12:07 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: addchild error




Hie, and thanks

i'd like make a windows with every page that i want to print before 
printing to select it

addpage is for print job isn't it ?

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Alex 
Harui [EMAIL PROTECTED] wrote:

 You can't add a child twice. Did you mean to call addPage?
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com  
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On 
Behalf Of wifi19
 Sent: Tuesday, March 27, 2007 1:57 PM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] addchild error
 
 
 
 I am having some trouble with addchild
 
 var thePrintView:FormPrintView = new FormPrintView();
 
 //myHbox.addChild(thePrintView); 
 var _caPan:Canvas = new Canvas();
 
 _caPan.height=300;
 _caPan.width = 200;
 
 
 _caPan.addChild(thePrintView);
 _caPan.addChild(thePrintView);
 
 second addchild generate a error
 
 RangeError: Error #2006: L'index indiqué sort des limites.
 at flash.display::DisplayObjectContainer/getChildAt()
 at mx.core::Container/getChildAt()
 at mx.core::UIComponent/set document()
 at 
 
mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::addin 
http://www.adobe.com/2006/flex/mx/internal::addin 
http://www.adobe.com/2006/flex/mx/internal::addin 
http://www.adobe.com/2006/flex/mx/internal::addin  
 gChild()
 at 
 
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingC 
http://www.adobe.com/2006/flex/mx/internal::addingC 
http://www.adobe.com/2006/flex/mx/internal::addingC 
http://www.adobe.com/2006/flex/mx/internal::addingC  
 hild()
 at mx.core::Container/addChildAt()
 at mx.core::Container/addChild()
 at MyLoginForm/process()
 at MyLoginForm/___TitleWindow1_initialize()
 at 
 
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEv
 entFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at mx.core::UIComponent/dispatchEvent()
 at mx.core::UIComponent/set processedDescriptors()
 at mx.core::Container/createComponentsFromDescriptors()
 at mx.containers::Panel/createComponentsFromDescriptors()
 at mx.core::Container/mx.core:Container::createChildren()
 at mx.containers::Panel/mx.containers:Panel::createChildren()
 at mx.core::UIComponent/initialize()
 at mx.core::Container/initialize()
 at MyLoginForm/initialize()
 at 
 
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal: 
http://www.adobe.com/2006/flex/mx/internal: 
http://www.adobe.com/2006/flex/mx/internal: 
http://www.adobe.com/2006/flex/mx/internal:  
 :childAdded()
 at 
 
mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal: 
http://www.adobe.com/2006/flex/mx/internal: 
http://www.adobe.com/2006/flex/mx/internal: 
http://www.adobe.com/2006/flex/mx/internal:  
 :rawChildren_addChildAt()
 at mx.managers::SystemManager/addChild()
 at mx.managers::PopUpManagerImpl/addPopUp()
 at mx.managers::PopUpManager$/addPopUp()
 at print/doPrint()
 at print/__printDG_click()




 


Re: [flexcoders] Re: addChild from String

2006-01-18 Thread Johannes Nel



search the flash coders list for this, there are a ton of sollutions floating around in there. On 1/18/06, Brendan Meutzner 

[EMAIL PROTECTED] wrote:Hey Jens,Thanks for the help.It's now working (sort of)...
If I create an instance of a built-in class (such as Button), themethod below works fine.However, if I try creating a custom Class(eg. MyCustClass which extends from Canvas) like so:import custclasses.MyCustClass

;var newComponent:Object = createInstance(custclasses.MyCustClass);it doesn't work.I get the run-time error message VariableMyCustClass is not defined.However, if I create a dummy instance of the class in my application
like so:import custclasses.MyCustClass;var dummyMyCustClass:MyCustClass = new MyCustClass();and then create another instance using the createInstance method, itdoes work.Ideas?
Thanks,
Brendan--- In flexcoders@yahoogroups.com, Jens Halm [EMAIL PROTECTED] wrote:
  Hi All,  I'd like to provide a String value which represents the DisplayObject
  class I want to create dynamically with addChild.Has anyone  accomplished this? You mean like this? public function createInstance (className : String) : Object {
 var MyClass : Class = getClassByName(className); return new MyClass(); } Btw.: what I really miss is a method createInstance(args : Array) in the Class class, so I could easily provide an arbitrary number of
 constructor arguments not known until runtime, like this: public function createInstance (className:String, args:Array) : Object { var myClass : Class = getClassByName(className);
 return 
myClass.createInstance(args); } Class.createInstance(args:Array) would be the constructor equivalent of Function.apply(scope:Object, args:Array). If I use Function.apply after I created an instance the constructor would be called twice
 which would be quite dirty. Consider this as a feature request...;) Jens 
www.oregano-server.org
--Flexcoders Mailing ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: 
http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
* To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/-- 
j:pn 







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.