Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-26 Thread Rob Romanek

Hi Ron,

Thanks for the suggestion but still no luck on my end.

It seems that on my set up I need to have a constructor named the same as  
the .as file and that constructor has to be initiated prior to any of the  
other classes being initiated. So I set up


public class MyPackage{
public function MyPackage{
}
}

and then can either do an import or set up the .as file as my document  
class and after that I can access HelloWorld or MyClass. This seems to  
follow the examples that came with the Flash 9 alpha, which all use the  
document class approach and none of the .as files has more than one class  
in them, even though you can put more than one class inside. So I'm still  
a bit flummoxed as to how the package is working for Jason and not me, ah  
well. Probably something stupid I'm doing and the light will go in a few  
days.


Just to complete this I've also tried creating a folder called MyPackage  
and putting the .as files in there and again without the constructor named  
the same as the .as file it did not work


My understanding of 'package' is that the dot path that occurs after it is  
the path to the .as file so if the MyPackage.as is sitting in the same  
directory as your .fla then I would only have 'package' at the top of the  
file, if it were in a directory called MyPackage then the syntax would be


package MyPackage

thanks for ideas,

Rob

On Sat, 24 Mar 2007 09:26:10 -0400, Ron Wheeler  
[EMAIL PROTECTED] wrote:



Something to try

change
import MyPackage.*;
to import myPackage.HelloWorld

import myPackage.MyClass


See if the errors change.

Ron

Merrill, Jason wrote:

I dunno, that's how I have it set up and it works fine for me - Perhaps
your Flash 9 Preview Alpha is messed up.  I assume your publish settings
are all correct, - I don't know why it would do that.

Jason Merrill
Bank of America  GTO Learning  Leadership Development
eTools  Multimedia Team

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-26 Thread elibol

Hi Rob,

The ability to define multiple classes in a single package was removed as of
Flex 1.5. It was removed with the class modifier *private*. There is still a
way to do it though.

First you need to change your file name to match the main class that is
being defined. The main class is the class that is within the package block.
You can then define any additional classes *outside* of the package block.
Classes outside of the package block cannot have any modifiers. The classes
are scoped to the classes within the .as file; no class outside of the .as
file can access these classes.

On 3/26/07, Rob Romanek [EMAIL PROTECTED] wrote:


Hi Ron,

Thanks for the suggestion but still no luck on my end.

It seems that on my set up I need to have a constructor named the same as
the .as file and that constructor has to be initiated prior to any of the
other classes being initiated. So I set up

public class MyPackage{
public function MyPackage{
}
}

and then can either do an import or set up the .as file as my document
class and after that I can access HelloWorld or MyClass. This seems to
follow the examples that came with the Flash 9 alpha, which all use the
document class approach and none of the .as files has more than one class
in them, even though you can put more than one class inside. So I'm still
a bit flummoxed as to how the package is working for Jason and not me, ah
well. Probably something stupid I'm doing and the light will go in a few
days.

Just to complete this I've also tried creating a folder called MyPackage
and putting the .as files in there and again without the constructor named
the same as the .as file it did not work

My understanding of 'package' is that the dot path that occurs after it is
the path to the .as file so if the MyPackage.as is sitting in the same
directory as your .fla then I would only have 'package' at the top of the
file, if it were in a directory called MyPackage then the syntax would be

package MyPackage

thanks for ideas,

Rob

On Sat, 24 Mar 2007 09:26:10 -0400, Ron Wheeler
[EMAIL PROTECTED] wrote:

 Something to try

 change
 import MyPackage.*;
 to import myPackage.HelloWorld

 import myPackage.MyClass


 See if the errors change.

 Ron

 Merrill, Jason wrote:
 I dunno, that's how I have it set up and it works fine for me - Perhaps
 your Flash 9 Preview Alpha is messed up.  I assume your publish
settings
 are all correct, - I don't know why it would do that.

 Jason Merrill
 Bank of America  GTO Learning  Leadership Development
 eTools  Multimedia Team
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-26 Thread elibol

Here is a good article on class/package syntax and structure:

http://probertson.com/articles/2006/07/28/one-file-many-as3-classes/

It turns out that one class per package is a Flex limitation.

On 3/26/07, elibol [EMAIL PROTECTED] wrote:


Hi Rob,

The ability to define multiple classes in a single package was removed as
of Flex 1.5. It was removed with the class modifier *private*. There is
still a way to do it though.

First you need to change your file name to match the main class that is
being defined. The main class is the class that is within the package block.
You can then define any additional classes *outside* of the package block.
Classes outside of the package block cannot have any modifiers. The classes
are scoped to the classes within the .as file; no class outside of the .as
file can access these classes.

On 3/26/07, Rob Romanek [EMAIL PROTECTED] wrote:

 Hi Ron,

 Thanks for the suggestion but still no luck on my end.

 It seems that on my set up I need to have a constructor named the same
 as
 the .as file and that constructor has to be initiated prior to any of
 the
 other classes being initiated. So I set up

 public class MyPackage{
 public function MyPackage{
 }
 }

 and then can either do an import or set up the .as file as my document
 class and after that I can access HelloWorld or MyClass. This seems to
 follow the examples that came with the Flash 9 alpha, which all use the
 document class approach and none of the .as files has more than one
 class
 in them, even though you can put more than one class inside. So I'm
 still
 a bit flummoxed as to how the package is working for Jason and not me,
 ah
 well. Probably something stupid I'm doing and the light will go in a few
 days.

 Just to complete this I've also tried creating a folder called MyPackage

 and putting the .as files in there and again without the constructor
 named
 the same as the .as file it did not work

 My understanding of 'package' is that the dot path that occurs after it
 is
 the path to the .as file so if the MyPackage.as is sitting in the same
 directory as your .fla then I would only have 'package' at the top of
 the
 file, if it were in a directory called MyPackage then the syntax would
 be

 package MyPackage

 thanks for ideas,

 Rob

 On Sat, 24 Mar 2007 09:26:10 -0400, Ron Wheeler
 [EMAIL PROTECTED] wrote:

  Something to try
 
  change
  import MyPackage.*;
  to import myPackage.HelloWorld
 
  import myPackage.MyClass
 
 
  See if the errors change.
 
  Ron
 
  Merrill, Jason wrote:
  I dunno, that's how I have it set up and it works fine for me -
 Perhaps
  your Flash 9 Preview Alpha is messed up.  I assume your publish
 settings
  are all correct, - I don't know why it would do that.
 
  Jason Merrill
  Bank of America  GTO Learning  Leadership Development
  eTools  Multimedia Team
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-26 Thread Ron Wheeler



Rob Romanek wrote:

Hi Ron,

Thanks for the suggestion but still no luck on my end.

It seems that on my set up I need to have a constructor named the same 
as the .as file and that constructor has to be initiated prior to any 
of the other classes being initiated. So I set up


Cat.as should contain the class Cat which should have a constructor 
called Cat.


Package is not required but helps group your classes into families 
(directories).

public class MyPackage{
public function MyPackage{
}
}

and then can either do an import or set up the .as file as my document 
class and after that I can access HelloWorld or MyClass. This seems to 
follow the examples that came with the Flash 9 alpha, which all use 
the document class approach and none of the .as files has more than 
one class in them, even though you can put more than one class inside. 
So I'm still a bit flummoxed as to how the package is working for 
Jason and not me, ah well. Probably something stupid I'm doing and the 
light will go in a few days.


Just to complete this I've also tried creating a folder called 
MyPackage and putting the .as files in there and again without the 
constructor named the same as the .as file it did not work


My understanding of 'package' is that the dot path that occurs after 
it is the path to the .as file so if the MyPackage.as is sitting in 
the same directory as your .fla then I would only have 'package' at 
the top of the file, if it were in a directory called MyPackage then 
the syntax would be


I do all my work in Eclipse but I think that the root of your classes is 
your classpath which you will set somewhere in the Flash IDE
The following would be a good directory structure for your 
documentation, sources and test specifications (there could be lots of 
other directories but the main one is the source directory


myproject
  docs
   src  //root of classpath
  com//start of package names
 manbus //com.manbus makes your packages unique
testproj // one of your projects so that package 
names are unique within your company

   animals // individual package directory
  animal.as
   cat.as  //sources
  dog.as
   view // another package
  listanimals.as  //source in the ...view package
   testspec_dir// jsut another project folder - no concern 
to Flash

.
.
.

src would be the root of my classpath
  
Cat.as would start

package com.manbus.testproj.animals
import com.manbus.testproj.animals.animal  //interface definition for 
all animals


class Cat implements Animal{
   private name:String
   public function Cat(name){this.name=name;}// Constructor for Cat
}
  
Dog.as would start

package com.manbus.testproj.animals
import com.manbus.testproj.animals.animal  //interface definition for 
all animals


class Dog implements Animal{
   private name:String
   public function Dog(name){this.name=name;}
}


I hope that this helps.


package MyPackage

thanks for ideas,

Rob

On Sat, 24 Mar 2007 09:26:10 -0400, Ron Wheeler 
[EMAIL PROTECTED] wrote:



Something to try

change
import MyPackage.*;
to import myPackage.HelloWorld

import myPackage.MyClass


See if the errors change.

Ron

Merrill, Jason wrote:

I dunno, that's how I have it set up and it works fine for me - Perhaps
your Flash 9 Preview Alpha is messed up.  I assume your publish 
settings

are all correct, - I don't know why it would do that.

Jason Merrill
Bank of America  GTO Learning  Leadership Development
eTools  Multimedia Team




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-26 Thread Rob Romanek
On Mon, 26 Mar 2007 12:17:10 -0400, elibol [EMAIL PROTECTED]  
wrote:



Here is a good article on class/package syntax and structure:

http://probertson.com/articles/2006/07/28/one-file-many-as3-classes/


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-26 Thread Rob Romanek

Hi Ron and elibol,

Thanks for the explanations and link both helped straighten out my  
understanding of the packaging structure.


Rob

On Mon, 26 Mar 2007 12:17:10 -0400, elibol [EMAIL PROTECTED]
wrote:


Here is a good article on class/package syntax and structure:

http://probertson.com/articles/2006/07/28/one-file-many-as3-classes/


and

On Mon, 26 Mar 2007 13:08:48 -0400, Ron Wheeler  
[EMAIL PROTECTED] wrote:


The following would be a good directory structure for your  
documentation, sources and test specifications (there could be lots of  
other directories but the main one is the source directory

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-25 Thread Ron Wheeler

Something to try

change
import MyPackage.*;
to 
import myPackage.HelloWorld


import myPackage.MyClass


See if the errors change.

Ron

Merrill, Jason wrote:

I dunno, that's how I have it set up and it works fine for me - Perhaps
your Flash 9 Preview Alpha is messed up.  I assume your publish settings
are all correct, - I don't know why it would do that.

Jason Merrill
Bank of America  
GTO Learning  Leadership Development

eTools  Multimedia Team


 

  

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf 
Of Rob Romanek

Sent: Friday, March 23, 2007 10:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

Hi Jason,

My packageTest.fla is

import MyPackage.*;
var hw:HelloWorld = new HelloWorld();
var mc:MyClass = new MyClass();

and in the same directory I have MyPackage.as

//MyPackage.as
package MyPackage
{

public class HelloWorld
{
public function HelloWorld()
{
trace(hello world constructor);
}
}

public class MyClass
{
public function MyClass()
{
trace(MyClass constructor);
}
}
}

In the windows Flash 9 Alpha IDE I try to run this and I get

**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time

constant: HelloWorld.
var hw:HelloWorld = new HelloWorld();
**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 3, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time

constant: MyClass.
var mc:MyClass = new MyClass();
ReferenceError: Error #1065: Variable
Timeline0_f549bc2eccff3a4d88caed7024db465e is not defined.

This seems to me as if it should work. I don't know if it is 
the Flash IDE causing me grief, if there is some preference 
file I don't have set correctly or what.


Other than this issue I'm having a lot of fun with AS3 
especially the new text features.


thanks,

Rob

On Thu, 22 Mar 2007 20:39:14 -0400, Merrill, Jason 
[EMAIL PROTECTED] wrote:


  

I have a question back at you along this example.
any insights why yours can run as MyPackage.as?


Do you start out your package as:

package MyPackage
{
//class definitions
}

and then import like this:

import MyPackage.*

?

That should work.



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training 
http://www.figleaf.com http://training.figleaf.com


  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-24 Thread Merrill, Jason
I dunno, that's how I have it set up and it works fine for me - Perhaps
your Flash 9 Preview Alpha is messed up.  I assume your publish settings
are all correct, - I don't know why it would do that.

Jason Merrill
Bank of America  
GTO Learning  Leadership Development
eTools  Multimedia Team


 

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf 
Of Rob Romanek
Sent: Friday, March 23, 2007 10:10 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

Hi Jason,

My packageTest.fla is

import MyPackage.*;
var hw:HelloWorld = new HelloWorld();
var mc:MyClass = new MyClass();

and in the same directory I have MyPackage.as

//MyPackage.as
package MyPackage
{

  public class HelloWorld
  {
  public function HelloWorld()
  {
  trace(hello world constructor);
  }
  }
  
  public class MyClass
  {
  public function MyClass()
  {
  trace(MyClass constructor);
  }
  }
}

In the windows Flash 9 Alpha IDE I try to run this and I get

**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time
constant: HelloWorld.
var hw:HelloWorld = new HelloWorld();
**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 3, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time
constant: MyClass.
var mc:MyClass = new MyClass();
ReferenceError: Error #1065: Variable
Timeline0_f549bc2eccff3a4d88caed7024db465e is not defined.

This seems to me as if it should work. I don't know if it is 
the Flash IDE causing me grief, if there is some preference 
file I don't have set correctly or what.

Other than this issue I'm having a lot of fun with AS3 
especially the new text features.

thanks,

Rob

On Thu, 22 Mar 2007 20:39:14 -0400, Merrill, Jason 
[EMAIL PROTECTED] wrote:

 I have a question back at you along this example.
 any insights why yours can run as MyPackage.as?

 Do you start out your package as:

 package MyPackage
 {
 //class definitions
 }

 and then import like this:

 import MyPackage.*

 ?

 That should work.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training 
http://www.figleaf.com http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-23 Thread DannyT

Hi Jason,

I wrote a simple tutorial for AS3 (and Flex2) in FlashDevelop, doesn't
involve the FlashIDE but a good place to get started playing with AS3 and if
you're interested in flex it covers the basics of that too. Also explains my
setup for having an FD for AS2 and one for AS3.

http://danny-t.co.uk/index.php/tutorials/free-flex2-development-environment/

Hope it helps you or anyone.

On 22/03/07, elibol [EMAIL PROTECTED] wrote:


I should mention why I thought it was a width/height issue.

UITextField and extending components (and some other components) in the
Flex
framework initialize to a width/height of 0... It really took me by
surprise
.

On 3/22/07, elibol [EMAIL PROTECTED] wrote:

 I see,

 You need to add HelloWorld to the main DisplayList.


 import MyPackage.*
 var hw:HelloWorld = new HelloWorld();

 addChild(hw);

 On 3/22/07, elibol [EMAIL PROTECTED] wrote:
 
  Hi Jason,
 
  Try setting the width and the height of the Textfield.
 
   http://www.pierinc.com
 
  On 3/22/07, Merrill, Jason [EMAIL PROTECTED] wrote:
  
   Getting my feet wet with AS3, I just bought the AS3 cookbook and
have
   learned a lot already - great book.  I feel like an idiot asking
this
   as
   I'm pretty good in AS2, but with AS3, I'm not getting a simple
script
   working. I have the Flash 9 AS3 preview, trying to write a simple
   HelloWorld class (based on an example in the book) to show a
   TextField:
  
   //MyPackage.as
   package MyPackage
   {
   //do I actually need this one?:
   import flash.display.DisplayObjectContainer;
  
   import flash.display.Sprite;
   import flash.text.TextField;
  
   public class HelloWorld extends Sprite
   {
   public function HelloWorld()
   {
   var message_txt:TextField = new TextField();
   message_txt.text = Hello World;
   addChild(message_txt);  //does not show!
   trace(constructor runs)//traces fine
   }
   }
   }
  
   Then in the .fla, I put:
  
   import MyPackage.*
   var hw:HelloWorld = new HelloWorld();
  
   The constructor traces fine in the output window, but the TextField
   does
   not show.  What have I done wrong?  My Export settings in F9 As3
   preview
   are for AS 3.0 and FP9.  In later scripts, I tried moving the
   textfield,
   changing the color, changing the stage color to be sure it wasn't
   matching the textfield and this invisible, etc...(but it should show
   as
   black Times New Roman text by default anyway...)
  
   Thanks,
  
   Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax
   set
   to AS3, but have notices code hinting doesn't always work or is
   sometimes incomplete - has anyone else noticed that?  Maybe I just
   need
   to update it.
  
   Jason Merrill
   Bank of America
   GTO Learning  Leadership Development
   eTools  Multimedia Team
  
  
  
   ___
   Flashcoders@chattyfig.figleaf.com
   To change your subscription options or search the archive:
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  
   Brought to you by Fig Leaf Software
   Premier Authorized Adobe Consulting and Training
   http://www.figleaf.com
   http://training.figleaf.com
  
 
 

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





--
http://danny-t.co.uk
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-23 Thread Merrill, Jason
I have a question back at you along this example.
any insights why yours can run as MyPackage.as?

Do you start out your package as: 

package MyPackage
{
//class definitions
}

and then import like this:

import MyPackage.*

?

That should work. 

if I change the name of the .as file to
HelloWorld.as
then all works fine

Yeah, I think it will still drill down and look for a class with the
same name if it doesn't find a package of the same name as the file. You
wouldn't want to name your files the same name as the class though...
the package file can contain multiple classes.


Jason Merrill
Bank of America  
GTO Learning  Leadership Development
eTools  Multimedia Team


 

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf 
Of Rob Romanek
Sent: Thursday, March 22, 2007 3:33 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

Try adding this to your fla

addChild(hw);

In your HelloWorld class you've added your textField inside 
but since you have added you HelloWorld() object to the 
display list of the movie it will never get drawn.



my.fla
[MyPackage]
MyPackage.as (with the HelloWorld class)

using the code in the fla I never get HelloWorld to properly 
initiate.  
Instead I get an error
**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time
constant: HelloWorld.
var hw:HelloWorld = new HelloWorld();

if I change the name of the .as file to
HelloWorld.as
then all works fine

any insights why yours can run as MyPackage.as?

Rob

On Thu, 22 Mar 2007 09:08:45 -0400, Merrill, Jason 
[EMAIL PROTECTED] wrote:

 //MyPackage.as
 package MyPackage
 {
 //do I actually need this one?:
 import flash.display.DisplayObjectContainer;

 import flash.display.Sprite;
 import flash.text.TextField;
 
 public class HelloWorld extends Sprite
 {
 public function HelloWorld()
 {
 var message_txt:TextField = new TextField();
 message_txt.text = Hello World;
 addChild(message_txt);  //does not show!
 trace(constructor runs)//traces fine
 }
 }
 }

 Then in the .fla, I put:

 import MyPackage.*
 var hw:HelloWorld = new HelloWorld();

 The constructor traces fine in the output window, but the TextField 
 does not show.  What have I done wrong?  My Export settings 
in F9 As3 
 preview are for AS 3.0 and FP9.  In later scripts, I tried 
moving the 
 textfield, changing the color, changing the stage color to 
be sure it 
 wasn't matching the textfield and this invisible, 
etc...(but it should 
 show as black Times New Roman text by default anyway...)


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training 
http://www.figleaf.com http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-23 Thread Rob Romanek

Hi Jason,

My packageTest.fla is

import MyPackage.*;
var hw:HelloWorld = new HelloWorld();
var mc:MyClass = new MyClass();

and in the same directory I have MyPackage.as

//MyPackage.as
package MyPackage
{

public class HelloWorld
{
public function HelloWorld()
{
trace(hello world constructor);
}
}

public class MyClass
{
public function MyClass()
{
trace(MyClass constructor);
}
}
}

In the windows Flash 9 Alpha IDE I try to run this and I get

**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time  
constant: HelloWorld.

var hw:HelloWorld = new HelloWorld();
**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 3, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time  
constant: MyClass.

var mc:MyClass = new MyClass();
ReferenceError: Error #1065: Variable  
Timeline0_f549bc2eccff3a4d88caed7024db465e is not defined.


This seems to me as if it should work. I don't know if it is the Flash IDE  
causing me grief, if there is some preference file I don't have set  
correctly or what.


Other than this issue I'm having a lot of fun with AS3 especially the new  
text features.


thanks,

Rob

On Thu, 22 Mar 2007 20:39:14 -0400, Merrill, Jason  
[EMAIL PROTECTED] wrote:



I have a question back at you along this example.
any insights why yours can run as MyPackage.as?


Do you start out your package as:

package MyPackage
{
//class definitions
}

and then import like this:

import MyPackage.*

?

That should work.


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-23 Thread Merrill, Jason
Hey thanks man - that explains maybe why my AS3 code completion isn't
working right in FlashDevelop.

Jason Merrill
Bank of America  
GTO Learning  Leadership Development
eTools  Multimedia Team


 

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of DannyT
Sent: Thursday, March 22, 2007 7:43 PM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

Hi Jason,

I wrote a simple tutorial for AS3 (and Flex2) in 
FlashDevelop, doesn't involve the FlashIDE but a good place 
to get started playing with AS3 and if you're interested in 
flex it covers the basics of that too. Also explains my setup 
for having an FD for AS2 and one for AS3.

http://danny-t.co.uk/index.php/tutorials/free-flex2-developmen
t-environment/

Hope it helps you or anyone.

On 22/03/07, elibol [EMAIL PROTECTED] wrote:

 I should mention why I thought it was a width/height issue.

 UITextField and extending components (and some other components) in 
 the Flex framework initialize to a width/height of 0... It 
really took 
 me by surprise
 .

 On 3/22/07, elibol [EMAIL PROTECTED] wrote:
 
  I see,
 
  You need to add HelloWorld to the main DisplayList.
 
 
  import MyPackage.*
  var hw:HelloWorld = new HelloWorld();
 
  addChild(hw);
 
  On 3/22/07, elibol [EMAIL PROTECTED] wrote:
  
   Hi Jason,
  
   Try setting the width and the height of the Textfield.
  
http://www.pierinc.com
  
   On 3/22/07, Merrill, Jason 
[EMAIL PROTECTED] wrote:
   
Getting my feet wet with AS3, I just bought the AS3 
cookbook and
 have
learned a lot already - great book.  I feel like an 
idiot asking
 this
as
I'm pretty good in AS2, but with AS3, I'm not getting a simple
 script
working. I have the Flash 9 AS3 preview, trying to write a 
simple HelloWorld class (based on an example in the book) to 
show a
TextField:
   
//MyPackage.as
package MyPackage
{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;
   
import flash.display.Sprite;
import flash.text.TextField;
   
public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = 
new TextField();
message_txt.text = Hello World;
addChild(message_txt);  
//does not show!
trace(constructor runs)//traces fine
}
}
}
   
Then in the .fla, I put:
   
import MyPackage.*
var hw:HelloWorld = new HelloWorld();
   
The constructor traces fine in the output window, but the 
TextField does not show.  What have I done wrong?  My Export 
settings in F9 As3 preview are for AS 3.0 and FP9.  In later 
scripts, I tried moving the textfield, changing the color, 
changing the stage color to be sure it wasn't matching the 
textfield and this invisible, etc...(but it should 
show as black 
Times New Roman text by default anyway...)
   
Thanks,
   
Oh, and as a side note, I use FlashDevelop 2.0.1 and have my 
syntax set to AS3, but have notices code hinting 
doesn't always 
work or is sometimes incomplete - has anyone else 
noticed that?  
Maybe I just need to update it.
   
Jason Merrill
Bank of America
GTO Learning  Leadership Development eTools  
Multimedia Team
   
   
   
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
   
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
   
  
  
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com




-- 
http://danny-t.co.uk
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Merrill, Jason
Getting my feet wet with AS3, I just bought the AS3 cookbook and have
learned a lot already - great book.  I feel like an idiot asking this as
I'm pretty good in AS2, but with AS3, I'm not getting a simple script
working. I have the Flash 9 AS3 preview, trying to write a simple
HelloWorld class (based on an example in the book) to show a TextField:

//MyPackage.as 
package MyPackage
{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

Thanks,

Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
to AS3, but have notices code hinting doesn't always work or is
sometimes incomplete - has anyone else noticed that?  Maybe I just need
to update it. 

Jason Merrill
Bank of America  
GTO Learning  Leadership Development
eTools  Multimedia Team


 
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread ben gomez farrell

Hey off the top of my head, I think I see the problem.
So, you add the text field child to the HelloWorld Sprite.  Adding the 
child in the hello world sprite, does not add it to the stage.  When you 
use add child alone, you have to pretend it's this.addChild.  If you 
chose to import flash.display.Stage and do Stage.addChild(message_txt) 
you'd see it.  What you did is add the field to just the sprite.  But 
where's the sprite?  It's nowhere still.


In the fla, I'd bet if you put

import MyPackage.*
var hw:HelloWorld = new HelloWorld();
addChild(hw);

it might just work!



Merrill, Jason wrote:

Getting my feet wet with AS3, I just bought the AS3 cookbook and have
learned a lot already - great book.  I feel like an idiot asking this as
I'm pretty good in AS2, but with AS3, I'm not getting a simple script
working. I have the Flash 9 AS3 preview, trying to write a simple
HelloWorld class (based on an example in the book) to show a TextField:

//MyPackage.as 
package MyPackage

{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

Thanks,

Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
to AS3, but have notices code hinting doesn't always work or is
sometimes incomplete - has anyone else noticed that?  Maybe I just need
to update it. 


Jason Merrill
Bank of America  
GTO Learning  Leadership Development

eTools  Multimedia Team


 
___

Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Anthony Lee

Hi Jason,

I'm just guessing here but how about:

addChild(hw);

Anthony

On 3/22/07, Merrill, Jason [EMAIL PROTECTED] wrote:


Getting my feet wet with AS3, I just bought the AS3 cookbook and have
learned a lot already - great book.  I feel like an idiot asking this as
I'm pretty good in AS2, but with AS3, I'm not getting a simple script
working. I have the Flash 9 AS3 preview, trying to write a simple
HelloWorld class (based on an example in the book) to show a TextField:

//MyPackage.as
package MyPackage
{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

Thanks,

Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
to AS3, but have notices code hinting doesn't always work or is
sometimes incomplete - has anyone else noticed that?  Maybe I just need
to update it.

Jason Merrill
Bank of America
GTO Learning  Leadership Development
eTools  Multimedia Team



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Andrés González Aragón

Hi,

In your fla add:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();
//You need to add the Child to the Stage
addChild(hw);


Other way to do it is set as 'Main Class 'of the fla file Helloworld.as, you
can do it in Publish settings in ActionScript option (the same where you set
the source paths).


Saludos

Andrés González Aragón
Desarrollador Multimedia

2007/3/22, Merrill, Jason [EMAIL PROTECTED]:


Getting my feet wet with AS3, I just bought the AS3 cookbook and have
learned a lot already - great book.  I feel like an idiot asking this as
I'm pretty good in AS2, but with AS3, I'm not getting a simple script
working. I have the Flash 9 AS3 preview, trying to write a simple
HelloWorld class (based on an example in the book) to show a TextField:

//MyPackage.as
package MyPackage
{
   //do I actually need this one?:
   import flash.display.DisplayObjectContainer;

   import flash.display.Sprite;
   import flash.text.TextField;

   public class HelloWorld extends Sprite
   {
   public function HelloWorld()
   {
   var message_txt:TextField = new TextField();
   message_txt.text = Hello World;
   addChild(message_txt);  //does not show!
   trace(constructor runs)//traces fine
   }
   }
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

Thanks,

Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
to AS3, but have notices code hinting doesn't always work or is
sometimes incomplete - has anyone else noticed that?  Maybe I just need
to update it.

Jason Merrill
Bank of America
GTO Learning  Leadership Development
eTools  Multimedia Team



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Petro Bochan
Hi,

Do additional addChild(hw) in your .fla file. Also, the
DisplayObjectContainer isn't needed.

Cheers,
Petro

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:flashcoders-
 [EMAIL PROTECTED] On Behalf Of Merrill, Jason
 Sent: Thursday, March 22, 2007 3:09 PM
 To: flashcoders@chattyfig.figleaf.com
 Subject: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld
 
 Getting my feet wet with AS3, I just bought the AS3 cookbook and have
 learned a lot already - great book.  I feel like an idiot asking this
as
 I'm pretty good in AS2, but with AS3, I'm not getting a simple script
 working. I have the Flash 9 AS3 preview, trying to write a simple
 HelloWorld class (based on an example in the book) to show a
TextField:
 
 //MyPackage.as
 package MyPackage
 {
   //do I actually need this one?:
   import flash.display.DisplayObjectContainer;
 
   import flash.display.Sprite;
   import flash.text.TextField;
 
   public class HelloWorld extends Sprite
   {
   public function HelloWorld()
   {
   var message_txt:TextField = new TextField();
   message_txt.text = Hello World;
   addChild(message_txt);  //does not show!
   trace(constructor runs)//traces fine
   }
   }
 }
 
 Then in the .fla, I put:
 
 import MyPackage.*
 var hw:HelloWorld = new HelloWorld();
 
 The constructor traces fine in the output window, but the TextField
does
 not show.  What have I done wrong?  My Export settings in F9 As3
preview
 are for AS 3.0 and FP9.  In later scripts, I tried moving the
textfield,
 changing the color, changing the stage color to be sure it wasn't
 matching the textfield and this invisible, etc...(but it should show
as
 black Times New Roman text by default anyway...)
 
 Thanks,
 
 Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax
set
 to AS3, but have notices code hinting doesn't always work or is
 sometimes incomplete - has anyone else noticed that?  Maybe I just
need
 to update it.
 
 Jason Merrill
 Bank of America
 GTO Learning  Leadership Development
 eTools  Multimedia Team
 
 
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Jim Berkey

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

I think that the flash 9 ide serves up the flash 8 stand-alone player - I 
believe that you need to replace that manually with the flash 9 standalone 
player or view your projects in a browser window with flash 9 installed in it.
jimbo

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread elibol

Hi Jason,

Try setting the width and the height of the Textfield.

www.pierinc.com

On 3/22/07, Merrill, Jason [EMAIL PROTECTED] wrote:


Getting my feet wet with AS3, I just bought the AS3 cookbook and have
learned a lot already - great book.  I feel like an idiot asking this as
I'm pretty good in AS2, but with AS3, I'm not getting a simple script
working. I have the Flash 9 AS3 preview, trying to write a simple
HelloWorld class (based on an example in the book) to show a TextField:

//MyPackage.as
package MyPackage
{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

Thanks,

Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
to AS3, but have notices code hinting doesn't always work or is
sometimes incomplete - has anyone else noticed that?  Maybe I just need
to update it.

Jason Merrill
Bank of America
GTO Learning  Leadership Development
eTools  Multimedia Team



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread David Ngo
Hey Jason,

If I remember correctly, I believe you also have to attach your HelloWorld
class to the stage (or was it display list?) via addChild. Instantiating it
via the constructor will only create it in memory and not automatically
attach to the display. I don't have the exact syntax, but I'm sure you can
search around on LiveDocs and get the answer you need.

David


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Merrill,
Jason
Sent: Thursday, March 22, 2007 6:09 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

Getting my feet wet with AS3, I just bought the AS3 cookbook and have
learned a lot already - great book.  I feel like an idiot asking this as
I'm pretty good in AS2, but with AS3, I'm not getting a simple script
working. I have the Flash 9 AS3 preview, trying to write a simple
HelloWorld class (based on an example in the book) to show a TextField:

//MyPackage.as 
package MyPackage
{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)

Thanks,

Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
to AS3, but have notices code hinting doesn't always work or is
sometimes incomplete - has anyone else noticed that?  Maybe I just need
to update it. 

Jason Merrill
Bank of America  
GTO Learning  Leadership Development
eTools  Multimedia Team


 
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread elibol

I see,

You need to add HelloWorld to the main DisplayList.


import MyPackage.*
var hw:HelloWorld = new HelloWorld();

addChild(hw);

On 3/22/07, elibol [EMAIL PROTECTED] wrote:


Hi Jason,

Try setting the width and the height of the Textfield.

http://www.pierinc.com

On 3/22/07, Merrill, Jason [EMAIL PROTECTED] wrote:

 Getting my feet wet with AS3, I just bought the AS3 cookbook and have
 learned a lot already - great book.  I feel like an idiot asking this as
 I'm pretty good in AS2, but with AS3, I'm not getting a simple script
 working. I have the Flash 9 AS3 preview, trying to write a simple
 HelloWorld class (based on an example in the book) to show a TextField:

 //MyPackage.as
 package MyPackage
 {
 //do I actually need this one?:
 import flash.display.DisplayObjectContainer;

 import flash.display.Sprite;
 import flash.text.TextField;

 public class HelloWorld extends Sprite
 {
 public function HelloWorld()
 {
 var message_txt:TextField = new TextField();
 message_txt.text = Hello World;
 addChild(message_txt);  //does not show!
 trace(constructor runs)//traces fine
 }
 }
 }

 Then in the .fla, I put:

 import MyPackage.*
 var hw:HelloWorld = new HelloWorld();

 The constructor traces fine in the output window, but the TextField does
 not show.  What have I done wrong?  My Export settings in F9 As3 preview
 are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,

 changing the color, changing the stage color to be sure it wasn't
 matching the textfield and this invisible, etc...(but it should show as
 black Times New Roman text by default anyway...)

 Thanks,

 Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax set
 to AS3, but have notices code hinting doesn't always work or is
 sometimes incomplete - has anyone else noticed that?  Maybe I just need
 to update it.

 Jason Merrill
 Bank of America
 GTO Learning  Leadership Development
 eTools  Multimedia Team



 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread elibol

I should mention why I thought it was a width/height issue.

UITextField and extending components (and some other components) in the Flex
framework initialize to a width/height of 0... It really took me by surprise

.


On 3/22/07, elibol [EMAIL PROTECTED] wrote:


I see,

You need to add HelloWorld to the main DisplayList.


import MyPackage.*
var hw:HelloWorld = new HelloWorld();

addChild(hw);

On 3/22/07, elibol [EMAIL PROTECTED] wrote:

 Hi Jason,

 Try setting the width and the height of the Textfield.

  http://www.pierinc.com

 On 3/22/07, Merrill, Jason [EMAIL PROTECTED] wrote:
 
  Getting my feet wet with AS3, I just bought the AS3 cookbook and have
  learned a lot already - great book.  I feel like an idiot asking this
  as
  I'm pretty good in AS2, but with AS3, I'm not getting a simple script
  working. I have the Flash 9 AS3 preview, trying to write a simple
  HelloWorld class (based on an example in the book) to show a
  TextField:
 
  //MyPackage.as
  package MyPackage
  {
  //do I actually need this one?:
  import flash.display.DisplayObjectContainer;
 
  import flash.display.Sprite;
  import flash.text.TextField;
 
  public class HelloWorld extends Sprite
  {
  public function HelloWorld()
  {
  var message_txt:TextField = new TextField();
  message_txt.text = Hello World;
  addChild(message_txt);  //does not show!
  trace(constructor runs)//traces fine
  }
  }
  }
 
  Then in the .fla, I put:
 
  import MyPackage.*
  var hw:HelloWorld = new HelloWorld();
 
  The constructor traces fine in the output window, but the TextField
  does
  not show.  What have I done wrong?  My Export settings in F9 As3
  preview
  are for AS 3.0 and FP9.  In later scripts, I tried moving the
  textfield,
  changing the color, changing the stage color to be sure it wasn't
  matching the textfield and this invisible, etc...(but it should show
  as
  black Times New Roman text by default anyway...)
 
  Thanks,
 
  Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax
  set
  to AS3, but have notices code hinting doesn't always work or is
  sometimes incomplete - has anyone else noticed that?  Maybe I just
  need
  to update it.
 
  Jason Merrill
  Bank of America
  GTO Learning  Leadership Development
  eTools  Multimedia Team
 
 
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Rob Romanek

Try adding this to your fla

addChild(hw);

In your HelloWorld class you've added your textField inside but since you  
have added you HelloWorld() object to the display list of the movie it  
will never get drawn.


I have a question back at you along this example. I'm running on windows  
and if I set up my project that I have


my.fla
[MyPackage]
   MyPackage.as (with the HelloWorld class)

using the code in the fla I never get HelloWorld to properly initiate.  
Instead I get an error
**Error** Scene 1, Layer 'Layer 1', Frame 1 : Line 2, Column 8 :  
[Compiler] Error #1046: Type was not found or was not a compile-time  
constant: HelloWorld.

var hw:HelloWorld = new HelloWorld();

if I change the name of the .as file to
HelloWorld.as
then all works fine

any insights why yours can run as MyPackage.as?

Rob

On Thu, 22 Mar 2007 09:08:45 -0400, Merrill, Jason  
[EMAIL PROTECTED] wrote:



//MyPackage.as
package MyPackage
{
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
}

Then in the .fla, I put:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();

The constructor traces fine in the output window, but the TextField does
not show.  What have I done wrong?  My Export settings in F9 As3 preview
are for AS 3.0 and FP9.  In later scripts, I tried moving the textfield,
changing the color, changing the stage color to be sure it wasn't
matching the textfield and this invisible, etc...(but it should show as
black Times New Roman text by default anyway...)



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

2007-03-22 Thread Merrill, Jason
That's weird that you also have to addChild() the class instance to the stage, 
but makes sense I guess - I thought addChild(textField) in the class would be 
enough, but I can see it now. Works. Thanks.

Jason Merrill
Bank of America  
GTO Learning  Leadership Development
eTools  Multimedia Team


 

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf 
Of Andrés González  Aragón
Sent: Thursday, March 22, 2007 11:34 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] Actionscript 3.0 help w/ simple HelloWorld

Hi,

In your fla add:

import MyPackage.*
var hw:HelloWorld = new HelloWorld();
//You need to add the Child to the Stage addChild(hw);


Other way to do it is set as 'Main Class 'of the fla file 
Helloworld.as, you can do it in Publish settings in 
ActionScript option (the same where you set the source paths).


Saludos

Andrés González Aragón
Desarrollador Multimedia

2007/3/22, Merrill, Jason [EMAIL PROTECTED]:

 Getting my feet wet with AS3, I just bought the AS3 
cookbook and have 
 learned a lot already - great book.  I feel like an idiot 
asking this 
 as I'm pretty good in AS2, but with AS3, I'm not getting a simple 
 script working. I have the Flash 9 AS3 preview, trying to write a 
 simple HelloWorld class (based on an example in the book) 
to show a TextField:

 //MyPackage.as
 package MyPackage
 {
//do I actually need this one?:
import flash.display.DisplayObjectContainer;

import flash.display.Sprite;
import flash.text.TextField;

public class HelloWorld extends Sprite
{
public function HelloWorld()
{
var message_txt:TextField = new TextField();
message_txt.text = Hello World;
addChild(message_txt);  //does not show!
trace(constructor runs)//traces fine
}
}
 }

 Then in the .fla, I put:

 import MyPackage.*
 var hw:HelloWorld = new HelloWorld();

 The constructor traces fine in the output window, but the TextField 
 does not show.  What have I done wrong?  My Export settings 
in F9 As3 
 preview are for AS 3.0 and FP9.  In later scripts, I tried 
moving the 
 textfield, changing the color, changing the stage color to 
be sure it 
 wasn't matching the textfield and this invisible, 
etc...(but it should 
 show as black Times New Roman text by default anyway...)

 Thanks,

 Oh, and as a side note, I use FlashDevelop 2.0.1 and have my syntax 
 set to AS3, but have notices code hinting doesn't always work or is 
 sometimes incomplete - has anyone else noticed that?  Maybe I just 
 need to update it.

 Jason Merrill
 Bank of America
 GTO Learning  Leadership Development eTools  Multimedia Team



 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com