Re: [Flashcoders] Error 1009

2010-02-26 Thread Victor Subervi
On Thu, Feb 25, 2010 at 4:13 PM, Keith Reinfeld
keithreinf...@comcast.netwrote:

  What should I be looking for?


This is too strange for words. I started commenting out code to see if I
could fix whatever it was that was broken. I figured I'd done just that.
Then I started uncommenting the code to see if I could break it and try and
identify exactly where the problem was. I couldn't break it! I didn't change
or delete anything. Go figure!
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-26 Thread David Benman
In general, when you really, really think your code is ok (which is  
probably a lot less often than you initially think), there might be  
issues with running the code that might cause an error. Some other  
things you can try:


1. Make sure all your AS files have been saved so you are actually  
running your latest code and not the previous saved version.


2. Go to control and select Delete ASO Files

3.  Make sure there aren't any odd invisible characters can get into  
your code from cutting and pasting and this cleanses your code. Copy  
your text from your script and paste into a simple text editor and  
then paste back into your script editor.


4. Close and restart Flash.



On Feb 26, 2010, at 6:34 AM, Victor Subervi wrote:


On Thu, Feb 25, 2010 at 4:13 PM, Keith Reinfeld
keithreinf...@comcast.netwrote:


What should I be looking for?




This is too strange for words. I started commenting out code to see  
if I
could fix whatever it was that was broken. I figured I'd done just  
that.
Then I started uncommenting the code to see if I could break it and  
try and
identify exactly where the problem was. I couldn't break it! I  
didn't change

or delete anything. Go figure!
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


David Benman
Interactive Developer
d...@dbenman.com
http://www.dbenman.com
(508) 954-1202 (cell)
(315) 637-8487 (home office)



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-26 Thread Victor Subervi
On Fri, Feb 26, 2010 at 9:31 AM, David Benman d...@dbenman.com wrote:

 In general, when you really, really think your code is ok (which is
 probably a lot less often than you initially think), there might be issues
 with running the code that might cause an error. Some other things you can
 try:

 1. Make sure all your AS files have been saved so you are actually running
 your latest code and not the previous saved version.

 2. Go to control and select Delete ASO Files

 3.  Make sure there aren't any odd invisible characters can get into your
 code from cutting and pasting and this cleanses your code. Copy your text
 from your script and paste into a simple text editor and then paste back
 into your script editor.

 4. Close and restart Flash.


Copied and pasted into a flash-notes file. Thanks!
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-25 Thread David Benman
Open your script in Flash and you can place debug break points to stop  
code execution at specific points. If you have no clue where the error  
occurs especially since Flash's output window errors can be vague,  
then if you run in debug mode, again ctrl-shift-enter, the debugger  
will stop at the first occurence of an error.


On Feb 24, 2010, at 11:17 AM, Henrik Andersson wrote:


Victor Subervi wrote:
On Tue, Feb 23, 2010 at 11:02 PM, Deepanjan Dasdeepanjan@gmail.com 
wrote:

Hey,
I have not seen your debugger error.



So how do I debug? I downloaded what I thought was the debugger and  
it was

just another copy of Flash!


Flash IS the debugger. Just hit ctrl-shift-enter on your keyboard  
and there you have it.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


David Benman
Interactive Developer
d...@dbenman.com
http://www.dbenman.com
(508) 954-1202 (cell)
(315) 637-8487 (home office)



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-25 Thread Victor Subervi
On Thu, Feb 25, 2010 at 10:46 AM, Keith Reinfeld
keithreinf...@comcast.netwrote:

 
  Yes, except instead of referencing a problem with the preloader, it
  references a problem with the *.as that will load after the preloader.
 

 I think you need to examine '*.as' then.


Yeah, that's what I thought too. That file executes without error by itself.
What should I be looking for?
TIA,
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Error 1009

2010-02-25 Thread Keith Reinfeld
 
 Yes, except instead of referencing a problem with the preloader, it
 references a problem with the *.as that will load after the preloader.


I think you need to examine '*.as' then. 

Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net

 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
 boun...@chattyfig.figleaf.com] On Behalf Of Victor Subervi
 Sent: Wednesday, February 24, 2010 9:38 AM
 To: Deepanjan Das
 Cc: Flash Coders List
 Subject: Re: [Flashcoders] Error 1009
 
 On Wed, Feb 24, 2010 at 10:35 AM, Deepanjan Das
 deepanjan@gmail.comwrote:
 
  Are you getting this error:
 
  TypeError: Error #1009: Cannot access a property or method of a null
 object
  reference.
  at Preloader/init()
  at Preloader()
  at test_fla::MainTimeline/frame1()
 
 
 Yes, except instead of referencing a problem with the preloader, it
 references a problem with the *.as that will load after the preloader.
 Also,
 the last line of the above doesn't come up.
 TIA,
 V
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 No virus found in this incoming message.
 Checked by AVG - www.avg.com
 Version: 9.0.733 / Virus Database: 271.1.1/2705 - Release Date:
 02/24/10 01:34:00

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-25 Thread Victor Subervi
On Thu, Feb 25, 2010 at 8:52 AM, David Benman d...@dbenman.com wrote:

 Open your script in Flash and you can place debug break points to stop code
 execution at specific points. If you have no clue where the error occurs
 especially since Flash's output window errors can be vague, then if you run
 in debug mode, again ctrl-shift-enter, the debugger will stop at the first
 occurence of an error.


I did that. I don't know how to use the debugger well (you guessed that, I'm
sure). It put up a red dot with an arrow pointing at this line of code:

l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);

Please tell me what it's trying to say.
TIA,
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Error 1009

2010-02-25 Thread Keith Reinfeld
 What should I be looking for? 

I have no idea without some code or reading the literal text of the error.
Is this '*.as' associated with the 'Splash.swf' you are loading? 

Going back to the preloader, I noticed that, in the code you posted at the
beginning of this thread, you do not have 'addChild(l)' anywhere. This
omission could very well be the cause of a null reference error. Try that. 

If that doesn't work then I guess you have more digging to do. 

Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net


 -Original Message-
 From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-
 boun...@chattyfig.figleaf.com] On Behalf Of Victor Subervi
 Sent: Thursday, February 25, 2010 1:37 PM
 To: Flash Coders List
 Subject: Re: [Flashcoders] Error 1009
 
 On Thu, Feb 25, 2010 at 10:46 AM, Keith Reinfeld
 keithreinf...@comcast.netwrote:
 
  
   Yes, except instead of referencing a problem with the preloader, it
   references a problem with the *.as that will load after the
 preloader.
  
 
  I think you need to examine '*.as' then.
 
 
 Yeah, that's what I thought too. That file executes without error by
 itself.
 What should I be looking for?
 TIA,
 V
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 No virus found in this incoming message.
 Checked by AVG - www.avg.com
 Version: 9.0.733 / Virus Database: 271.1.1/2709 - Release Date:
 02/25/10 01:34:00

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-25 Thread Henrik Andersson

Victor Subervi wrote:

On Thu, Feb 25, 2010 at 8:52 AM, David Benmand...@dbenman.com  wrote:


Open your script in Flash and you can place debug break points to stop code
execution at specific points. If you have no clue where the error occurs
especially since Flash's output window errors can be vague, then if you run
in debug mode, again ctrl-shift-enter, the debugger will stop at the first
occurence of an error.



I did that. I don't know how to use the debugger well (you guessed that, I'm
sure). It put up a red dot with an arrow pointing at this line of code:


That's a breakpoint. It just means that you requested that the execution 
should be broken there. Just click at it (or where it should be) to 
toggle it.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Victor Subervi
On Tue, Feb 23, 2010 at 11:02 PM, Deepanjan Das deepanjan@gmail.comwrote:

 Hey,
 I have not seen your debugger error.


So how do I debug? I downloaded what I thought was the debugger and it was
just another copy of Flash!


 but I feel its the stage that is getting null value.

 Please trace stage to find out.


I traced stage from the preloader where I call the main script and it traced
out Object stage.
TIA,
Victor
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Deepanjan Das
Hi Victor,
Did u trace within Preloader Class?

DD

On Wed, Feb 24, 2010 at 7:48 PM, Victor Subervi victorsube...@gmail.comwrote:

 On Tue, Feb 23, 2010 at 11:02 PM, Deepanjan Das 
 deepanjan@gmail.comwrote:

 Hey,
 I have not seen your debugger error.


 So how do I debug? I downloaded what I thought was the debugger and it was
 just another copy of Flash!


 but I feel its the stage that is getting null value.

 Please trace stage to find out.


 I traced stage from the preloader where I call the main script and it
 traced out Object stage.
 TIA,
 Victor




-- 
Warm Regards
Deepanjan Das
M: +91 9836582808

Think of the environment before printing this email
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Victor Subervi
On Wed, Feb 24, 2010 at 10:22 AM, Deepanjan Das deepanjan@gmail.comwrote:

 Hi Victor,
 Did u trace within Preloader Class?


yes.
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Deepanjan Das
Are you getting this error:

TypeError: Error #1009: Cannot access a property or method of a null object
reference.
at Preloader/init()
at Preloader()
at test_fla::MainTimeline/frame1()

DD

On Wed, Feb 24, 2010 at 7:59 PM, Victor Subervi victorsube...@gmail.comwrote:

 On Wed, Feb 24, 2010 at 10:22 AM, Deepanjan Das 
 deepanjan@gmail.comwrote:

 Hi Victor,
 Did u trace within Preloader Class?


 yes.
 V




-- 
Warm Regards
Deepanjan Das
M: +91 9836582808

Think of the environment before printing this email
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Error 1009

2010-02-24 Thread Keith Reinfeld
Your code references the stage (to position your textfield) so you need to
listen for the ADDED_TO_STAGE event to prevent the null reference. 
 
Example: 
 
package{ 
import flash.events.Event; 
import flash.display.MovieClip; 
public class Preloader extends MovieClip{ 
public function Preloader(){ 
addEventListener(Event.ADDED_TO_STAGE, init, false,
0, true); 
} 
private function init(e:Event){ 
removeEventListener(Event.ADDED_TO_STAGE, init); 
// do stuff 
} 
} 
} 
 
HTH 
 
Regards,

Keith Reinfeld
Home Page: http://keithreinfeld.home.comcast.net



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Victor Subervi
On Wed, Feb 24, 2010 at 10:35 AM, Deepanjan Das deepanjan@gmail.comwrote:

 Are you getting this error:

 TypeError: Error #1009: Cannot access a property or method of a null object
 reference.
 at Preloader/init()
 at Preloader()
 at test_fla::MainTimeline/frame1()


Yes, except instead of referencing a problem with the preloader, it
references a problem with the *.as that will load after the preloader. Also,
the last line of the above doesn't come up.
TIA,
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Victor Subervi
On Wed, Feb 24, 2010 at 11:01 AM, Keith Reinfeld
keithreinf...@comcast.netwrote:

 Your code references the stage (to position your textfield) so you need to
 listen for the ADDED_TO_STAGE event to prevent the null reference.

 Example:

 package{
import flash.events.Event;
 import flash.display.MovieClip;
 public class Preloader extends MovieClip{
 public function Preloader(){
addEventListener(Event.ADDED_TO_STAGE, init, false,
 0, true);
}
private function init(e:Event){
removeEventListener(Event.ADDED_TO_STAGE, init);
// do stuff
}
}
 }


I tried that but it didn't help.
TIA,
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Jared
Also, if you go to publish settings  enable debugging or whatever,  
you can see the line number of the errors.


Sent from my iPhone

On Feb 24, 2010, at 8:38 AM, Victor Subervi victorsube...@gmail.com  
wrote:



On Wed, Feb 24, 2010 at 11:01 AM, Keith Reinfeld
keithreinf...@comcast.netwrote:

Your code references the stage (to position your textfield) so you  
need to

listen for the ADDED_TO_STAGE event to prevent the null reference.

Example:

package{
  import flash.events.Event;
   import flash.display.MovieClip;
   public class Preloader extends MovieClip{
   public function Preloader(){
  addEventListener(Event.ADDED_TO_STAGE, init,  
false,

0, true);
  }
  private function init(e:Event){
  removeEventListener(Event.ADDED_TO_STAGE,  
init);

  // do stuff
  }
  }
}



I tried that but it didn't help.
TIA,
V
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-24 Thread Henrik Andersson

Victor Subervi wrote:

On Tue, Feb 23, 2010 at 11:02 PM, Deepanjan Dasdeepanjan@gmail.comwrote:

Hey,
I have not seen your debugger error.



So how do I debug? I downloaded what I thought was the debugger and it was
just another copy of Flash!


Flash IS the debugger. Just hit ctrl-shift-enter on your keyboard and 
there you have it.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Error 1009

2010-02-23 Thread Victor Subervi
Hi;
I have a preloader that (obviously) calls another swf onload. This other swf
loads by itself with no problem; however, it calls another script and
apparently this is what's throwing the error.  Curtis Morley says I should
add that other script to the first frame of a timeline and set the alpha to
0. What's a purely AS3 solution to this?
Thanks,
Victor
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-23 Thread Henrik Andersson

Victor Subervi wrote:

Hi;
I have a preloader that (obviously) calls another swf onload. This other swf
loads by itself with no problem; however, it calls another script and
apparently this is what's throwing the error.


What error? Use the debugger and find out!
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-23 Thread Glen Pike
Are you listening for Event.INIT or Event.COMPLETE for your 
preloader?  You should possibly use the former to make sure all your 
child clips are instanciated before you run AS3 code that accesses these 
child clips.


Victor Subervi wrote:

Hi;
I have a preloader that (obviously) calls another swf onload. This other swf
loads by itself with no problem; however, it calls another script and
apparently this is what's throwing the error.  Curtis Morley says I should
add that other script to the first frame of a timeline and set the alpha to
0. What's a purely AS3 solution to this?
Thanks,
Victor
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


  


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-23 Thread Victor Subervi
On Tue, Feb 23, 2010 at 12:04 PM, Glen Pike g...@engineeredarts.co.ukwrote:

 Are you listening for Event.INIT or Event.COMPLETE for your preloader?
  You should possibly use the former to make sure all your child clips are
 instanciated before you run AS3 code that accesses these child clips.


Yes. I changed COMPLETE to INIT and got the same error:

package
{
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
import com.greensock.*;
import com.greensock.easing.*;
import flash.display.Loader;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFieldAutoSize;
import flash.net.URLRequest;
 public class Preloader extends MovieClip
{
private var l:Loader = new Loader();
private var myTextField:TextField = new TextField();
 function Preloader()
{
init();
}
 function init()
{
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest(Splash.swf));
addChild(myTextField);
myTextField.width = 250;
myTextField.x = stage.stageWidth/2 - 50;
myTextField.y = stage.stageHeight/2;
myTextField.selectable = false;
myTextField.border = false;
myTextField.borderColor = 0xAA;
myTextField.autoSize = TextFieldAutoSize.LEFT;
var myFormat:TextFormat = new TextFormat();
myFormat.color = 0xAA;
myFormat.size = 24;
myFormat.italic = true;
//myTextField.setTextFormat(myFormat);
myTextField.defaultTextFormat = myFormat;
}

function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded/e.bytesTotal;
myTextField.text = Math.ceil(perc*100).toString() + %;
}

function done(e:Event):void
{
removeChildAt(0);
myTextField = null;
addChild(l);
}
}
}

For Hendrik, I am currently downloading the debugger. It's big!
TIA,
Victor
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-23 Thread Henrik Andersson

Victor Subervi wrote:

For Hendrik, I am currently downloading the debugger. It's big!


Eh? The content debugging player is only marginally bigger than the 
normal player. It is smaller than some movies.


Then again, you need a debugger for the player to connect to. It is 
integrated in all serious IDEs. That is most likely what you are saying 
is big.


Btw, you got my name wrong.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error 1009

2010-02-23 Thread Deepanjan Das
Hey,
I have not seen your debugger error. but I feel its the stage that is
getting null value.

Please trace stage to find out.

Let me know.

Cheers
Deepanjan Das

On Tue, Feb 23, 2010 at 11:45 PM, Victor Subervi victorsube...@gmail.comwrote:

 On Tue, Feb 23, 2010 at 12:04 PM, Glen Pike g...@engineeredarts.co.uk
 wrote:

  Are you listening for Event.INIT or Event.COMPLETE for your preloader?
   You should possibly use the former to make sure all your child clips are
  instanciated before you run AS3 code that accesses these child clips.
 

 Yes. I changed COMPLETE to INIT and got the same error:

 package
 {
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.display.MovieClip;
 import com.greensock.*;
 import com.greensock.easing.*;
 import flash.display.Loader;
 import flash.events.ProgressEvent;
 import flash.text.TextField;
 import flash.text.TextFormat;
 import flash.text.TextFieldAutoSize;
 import flash.net.URLRequest;
  public class Preloader extends MovieClip
 {
 private var l:Loader = new Loader();
 private var myTextField:TextField = new TextField();
  function Preloader()
 {
 init();
 }
  function init()
 {
 l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
 l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
 l.load(new URLRequest(Splash.swf));
 addChild(myTextField);
 myTextField.width = 250;
 myTextField.x = stage.stageWidth/2 - 50;
 myTextField.y = stage.stageHeight/2;
 myTextField.selectable = false;
 myTextField.border = false;
 myTextField.borderColor = 0xAA;
 myTextField.autoSize = TextFieldAutoSize.LEFT;
 var myFormat:TextFormat = new TextFormat();
 myFormat.color = 0xAA;
 myFormat.size = 24;
 myFormat.italic = true;
 //myTextField.setTextFormat(myFormat);
 myTextField.defaultTextFormat = myFormat;
 }

 function loop(e:ProgressEvent):void
 {
 var perc:Number = e.bytesLoaded/e.bytesTotal;
 myTextField.text = Math.ceil(perc*100).toString() + %;
 }

 function done(e:Event):void
 {
 removeChildAt(0);
 myTextField = null;
 addChild(l);
 }
 }
 }

 For Hendrik, I am currently downloading the debugger. It's big!
 TIA,
 Victor
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
Warm Regards
Deepanjan Das
M: +91 9836582808

Think of the environment before printing this email
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Error #1009 shows randomly

2009-06-30 Thread Isaac Alves
Hello fellows,
I've bought at Flash Den a code of an Infinite Level Menu (from MBMedia) and
I'm pulling my hair out.

It throws that well known error as the text of the button doesn't show when
it should:

“TypeError: Error #1009: cannot access a  property or method of a null
object reference. at local.display:rimaryButton/frame7()”
That without touching the code or elements on the stage. Actually, if inside
the main.fla file, I go inside the Expanding Menu and then inside the
Primary Button MovieClip and select the text field and at that point I test
the movie, it works correctly. As long as I leave the Primary Button
movieclip and test the movie, it throws that error again!

Obs: It is not actually  randomly that it  throws that error. I've tried a
thousand times to test the movie within a certain state  , that means,foe
example, when I'm iinside a certain movieclip  with the textfield selected.
and in that specific situation it always throws (or not) the error.

You know, I select a movieclip , test Movie and it works. I deselect it,
test movie  and it doesn't . Its seems like a bug... that's very bizarre.

Please help !!!
Thanks a lot,
Isaac
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009 shows randomly

2009-06-30 Thread Sidney de Koning

Hi Isaac,

As far as i can see it that you took off the P when going through the  
code, since it gives an error that it canot find  
local.display:rimaryButton on frame 7.
Try looking there, maybee you changed the linkage identifier or the  
classname.


HTH,

Sidney de Koning

On Jun 30, 2009, at 4:49 PM, Isaac Alves wrote:


Hello fellows,
I've bought at Flash Den a code of an Infinite Level Menu (from  
MBMedia) and

I'm pulling my hair out.

It throws that well known error as the text of the button doesn't  
show when

it should:

“TypeError: Error #1009: cannot access a  property or method of a null
object reference. at local.display:rimaryButton/frame7()”
That without touching the code or elements on the stage. Actually,  
if inside

the main.fla file, I go inside the Expanding Menu and then inside the
Primary Button MovieClip and select the text field and at that point  
I test

the movie, it works correctly. As long as I leave the Primary Button
movieclip and test the movie, it throws that error again!

Obs: It is not actually  randomly that it  throws that error. I've  
tried a
thousand times to test the movie within a certain state  , that  
means,foe
example, when I'm iinside a certain movieclip  with the textfield  
selected.

and in that specific situation it always throws (or not) the error.

You know, I select a movieclip , test Movie and it works. I deselect  
it,
test movie  and it doesn't . Its seems like a bug... that's very  
bizarre.


Please help !!!
Thanks a lot,
Isaac
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Sidney de Koning - be a geek, in rockstar style!
Flash / AIR Developer @ www.funky-monkey.nl
Technical Writer @ www.insideria.com

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009 and gotoAndStop()

2008-07-14 Thread Geografiek

Hi,
Shouldn't that be
_label.text = label;?
HTH
Willem

Op 12-jul-2008, om 14:00 heeft Pavel Krůšek het volgende geschreven:


Hi List,

i have MovieClip with some keyframes, on each keyframe is dynamic  
TextField with different properties (font, color etc.).


In constructor - class NavigationItem.as I'm trying to jump to  
frame and fill TextField with some text:




gotoAndStop( _level );
_label.text = label;
_label.autoSize = TextFieldAutoSize.LEFT;



TypeError: Error #1009: Cannot access a property or method of a  
null object reference.


It is clear for me - the script runs before frame in the animation  
has been reached, but how it fix?


Thanks

Pavel



=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31) 
30-2719512 or cell phone: (+31)6-26372378

or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=



___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009 and gotoAndStop()

2008-07-14 Thread Matheus Gorino
Some possible ways to solve this issue:
1. Use the addFrameScript to add your code in the correct frame;
2. Create and ENTER_FRAME listener to wait the availability of the
TextField and then execute the code;

I also created a simple GoToFrame class that sends a MovieClip to some
frame and waits its availability to call a callback function. The
class is attached.

Best,
matheusgorino.


On Mon, Jul 14, 2008 at 6:13 AM, Geografiek [EMAIL PROTECTED] wrote:
 Hi,
 Shouldn't that be
 _label.text = label;?
 HTH
 Willem

 Op 12-jul-2008, om 14:00 heeft Pavel Krůšek het volgende geschreven:

 Hi List,

 i have MovieClip with some keyframes, on each keyframe is dynamic
 TextField with different properties (font, color etc.).

 In constructor - class NavigationItem.as I'm trying to jump to frame and
 fill TextField with some text:

 
 
 gotoAndStop( _level );
 _label.text = label;
 _label.autoSize = TextFieldAutoSize.LEFT;
 
 

 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.

 It is clear for me - the script runs before frame in the animation has
 been reached, but how it fix?

 Thanks

 Pavel


 =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
 Geografiek is a Dutch, Utrecht-based map and chart design company.
 Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or
 cell phone: (+31)6-26372378
 or by fax: (+31)302719687
 snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
 Visit our website at: http://www.geografiek.nl
 =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=



 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Error #1009 and gotoAndStop()

2008-07-12 Thread Pavel Krůšek

Hi List,

i have MovieClip with some keyframes, on each keyframe is dynamic  
TextField with different properties (font, color etc.).


In constructor - class NavigationItem.as I'm trying to jump to frame  
and fill TextField with some text:




gotoAndStop( _level );
_label.text = label;
_label.autoSize = TextFieldAutoSize.LEFT;



TypeError: Error #1009: Cannot access a property or method of a null  
object reference.


It is clear for me - the script runs before frame in the animation has  
been reached, but how it fix?


Thanks

Pavel
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009 and gotoAndStop()

2008-07-12 Thread Steven Sacks
Creat a function that does the setting on the TextField and call it from 
that frame.


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
Hi
 (posted in flashnewbies but the list is not very active and i need to
solve this problemas soon as possible)
 i have a problem while creating a as3 short animation:

 When i test the movie(all done with as3) i get this:

 TypeError: Error #1009: Cannot access a property or method of a null
 object reference.
at Mountain/init2()
at Mountain$iinit()
at RisingCroix/::init()
at RisingCroix$iinit()


 my code:
 package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;

private var vy:Number=5;
private var glowFilter:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
croix=new Croix;
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2;
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2;
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

var mountain:Mountain = new Mountain //i guess
it is here wher it stucks
addChild(mountain);
mountain.x = stage.stageWidth / 2;
mountain.y = stage.stageHeight / 2;

glowFilter = new GlowFilter(0x00, 0.6, 30,
30, 2, 1);
blurFilter = new BlurFilter(6,6,1);
blurFilter2 = new BlurFilter(13,13,3);

addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void {
if (croix.ystage.stageHeight/2) {
croix.y -=vy;
}
if (croix2R.ystage.stageHeight/2-10) {
croix2R.y -= vy/3*2;
croix2L.y  -= vy/3*2;
}
croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters =[blurFilter2];

}
}
 }

 and the Mountain CLass

 package {
import flash.display.Sprite;

public class Mountain extends Sprite {
private var color1:uint=0x003300;
private var color2:uint=0x001700;

public function Mountain() {
init2();
}
public function init2():void {

graphics.beginFill(color1);
graphics.drawRect(0,0,stage.stageWidth,
stage.stageHeight/2);
graphics.endFill();
}
}
 }



 --
 Pedro D.K.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009

2008-03-17 Thread jonathan howe
Missing () after Mountain instantiation, first of all...

var mountain:Mountain = new Mountain();



On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec [EMAIL PROTECTED] wrote:

 Hi
  (posted in flashnewbies but the list is not very active and i need to
 solve this problemas soon as possible)
  i have a problem while creating a as3 short animation:

  When i test the movie(all done with as3) i get this:

  TypeError: Error #1009: Cannot access a property or method of a null
  object reference.
at Mountain/init2()
at Mountain$iinit()
at RisingCroix/::init()
at RisingCroix$iinit()


  my code:
  package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;

private var vy:Number=5;
private var glowFilter:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
croix=new Croix;
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2;
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2;
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

var mountain:Mountain = new Mountain //i guess
 it is here wher it stucks
addChild(mountain);
mountain.x = stage.stageWidth / 2;
mountain.y = stage.stageHeight / 2;

glowFilter = new GlowFilter(0x00, 0.6, 30,
 30, 2, 1);
blurFilter = new BlurFilter(6,6,1);
blurFilter2 = new BlurFilter(13,13,3);

addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void {
if (croix.ystage.stageHeight/2) {
croix.y -=vy;
}
if (croix2R.ystage.stageHeight/2-10) {
croix2R.y -= vy/3*2;
croix2L.y  -= vy/3*2;
}
croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters =[blurFilter2];

}
}
  }

  and the Mountain CLass

  package {
import flash.display.Sprite;

public class Mountain extends Sprite {
private var color1:uint=0x003300;
private var color2:uint=0x001700;

public function Mountain() {
init2();
}
public function init2():void {

graphics.beginFill(color1);
graphics.drawRect(0,0,stage.stageWidth,
 stage.stageHeight/2);
graphics.endFill();
}
}
  }



  --
  Pedro D.K.
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




-- 
-jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009

2008-03-17 Thread Sidney de Koning

Have you tried importing the Mountain Class?

Cheers,

Sid

On Mar 17, 2008, at 4:28 PM, Pedro Kostelec wrote:


I added the () to it but still doesn't work:

package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;
private var sun:Sun;
private var mountain:Mountain;

private var vy:Number=5;
private var glowFilter:GlowFilter;
private var glowSun:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
sun = new Sun();
addChild(sun);
sun.x = stage.stageWidth / 2;
sun.y=stage.stageHeight;

croix=new Croix();
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2();
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2();
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

mountain= new Mountain();
addChild(mountain);
mountain.x = stage.stageWidth/2;
mountain.y = stage.stageHeight/2;

glowFilter = new GlowFilter(0xCC, 0.6, 30, 30, 3, 
1);
blurFilter = new BlurFilter(3,3,1);
blurFilter2 = new BlurFilter(13,13,3);
glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2, 1, 
true);

croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters =[blurFilter2];
sun.filters = [glowSun, blurFilter2];

addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void {
//...
}

}
}
}

Mountain class final:

package {
import flash.display.Sprite;

public class Mountain extends Sprite {
private var x0:Number =0;
private var y0:Number =stage.stageHeight -150;
private var x1:Number=stage.stageWidth/2;
private var y1:Number=100;
private var x2:Number =stage.stageWidth;
private var y2:Number =stage.stageHeight -150;

public function Mountain() {
init();
}
public function init():void {
graphics.beginFill(0x256251);
graphics.moveTo(x0,y0);
graphics.curveTo(x1,y1,x2,y2);
graphics.lineTo(x2, stage.stageHeight);
graphics.lineTo(0, stage.stageHeight);
graphics.endFill();
}
}
}

On Mon, Mar 17, 2008 at 3:58 PM, jonathan howe [EMAIL PROTECTED] 
 wrote:

Missing () after Mountain instantiation, first of all...

var mountain:Mountain = new Mountain();





On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec  
[EMAIL PROTECTED] wrote:



Hi
(posted in flashnewbies but the list is not very active and i need  
to

solve this problemas soon as possible)
i have a problem while creating a as3 short animation:

When i test the movie(all done with as3) i get this:

TypeError: Error #1009: Cannot access a property or method of a null
object reference.
  at Mountain/init2()
  at Mountain$iinit()
  at RisingCroix/::init()
  at RisingCroix$iinit()


my code:
package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.filters.*;

  public class RisingCroix extends Sprite {
  private var croix:Croix;
  private var croix2L:Croix2;
  private var croix2R:Croix2;

  private var vy:Number=5;
  private var glowFilter:GlowFilter;
  private var blurFilter:BlurFilter;
  private var blurFilter2:BlurFilter;

  public function RisingCroix() {
  init();
  }
  private function init():void {
  croix=new Croix;
  addChild(croix);
   

Re: [Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
I added the () to it but still doesn't work:

package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;
private var sun:Sun;
private var mountain:Mountain;

private var vy:Number=5;
private var glowFilter:GlowFilter;
private var glowSun:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
sun = new Sun();
addChild(sun);
sun.x = stage.stageWidth / 2;
sun.y=stage.stageHeight;

croix=new Croix();
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2();
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2();
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

mountain= new Mountain();
addChild(mountain);
mountain.x = stage.stageWidth/2;
mountain.y = stage.stageHeight/2;

glowFilter = new GlowFilter(0xCC, 0.6, 30, 30, 3, 
1);
blurFilter = new BlurFilter(3,3,1);
blurFilter2 = new BlurFilter(13,13,3);
glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2, 1, 
true);

croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters =[blurFilter2];
sun.filters = [glowSun, blurFilter2];

addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void {
//...
}

}
}
}

Mountain class final:

package {
import flash.display.Sprite;

public class Mountain extends Sprite {
private var x0:Number =0;
private var y0:Number =stage.stageHeight -150;
private var x1:Number=stage.stageWidth/2;
private var y1:Number=100;
private var x2:Number =stage.stageWidth;
private var y2:Number =stage.stageHeight -150;

public function Mountain() {
init();
}
public function init():void {
graphics.beginFill(0x256251);
graphics.moveTo(x0,y0);
graphics.curveTo(x1,y1,x2,y2);
graphics.lineTo(x2, stage.stageHeight);
graphics.lineTo(0, stage.stageHeight);
graphics.endFill();
}
}
}

On Mon, Mar 17, 2008 at 3:58 PM, jonathan howe [EMAIL PROTECTED] wrote:
 Missing () after Mountain instantiation, first of all...

  var mountain:Mountain = new Mountain();





  On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec [EMAIL PROTECTED] wrote:

   Hi
(posted in flashnewbies but the list is not very active and i need to
   solve this problemas soon as possible)
i have a problem while creating a as3 short animation:
  
When i test the movie(all done with as3) i get this:
  
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
  at Mountain/init2()
  at Mountain$iinit()
  at RisingCroix/::init()
  at RisingCroix$iinit()
  
  
my code:
package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.filters.*;
  
  public class RisingCroix extends Sprite {
  private var croix:Croix;
  private var croix2L:Croix2;
  private var croix2R:Croix2;
  
  private var vy:Number=5;
  private var glowFilter:GlowFilter;
  private var blurFilter:BlurFilter;
  private var blurFilter2:BlurFilter;
  
  public function RisingCroix() {
  init();
  }
  private function init():void {
  croix=new Croix;
  

Re: [Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
NO , ihaven't. I am only in a learning process of as3, so if you can
help me importing a class

On Mon, Mar 17, 2008 at 4:35 PM, Sidney de Koning
[EMAIL PROTECTED] wrote:
 Have you tried importing the Mountain Class?

  Cheers,

  Sid



  On Mar 17, 2008, at 4:28 PM, Pedro Kostelec wrote:

   I added the () to it but still doesn't work:
  
   package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;
  
 public class RisingCroix extends Sprite {
 private var croix:Croix;
 private var croix2L:Croix2;
 private var croix2R:Croix2;
 private var sun:Sun;
 private var mountain:Mountain;
  
 private var vy:Number=5;
 private var glowFilter:GlowFilter;
 private var glowSun:GlowFilter;
 private var blurFilter:BlurFilter;
 private var blurFilter2:BlurFilter;
  
 public function RisingCroix() {
 init();
 }
 private function init():void {
 sun = new Sun();
 addChild(sun);
 sun.x = stage.stageWidth / 2;
 sun.y=stage.stageHeight;
  
 croix=new Croix();
 addChild(croix);
 croix.x=stage.stageWidth / 2;
 croix.y=stage.stageHeight;
  
 croix2L = new Croix2();
 addChild(croix2L);
 croix2L.x=stage.stageWidth /4;
 croix2L.y = stage.stageHeight;
  
 croix2R = new Croix2();
 addChild(croix2R);
 croix2R.x = stage.stageWidth /4 *3;
 croix2R.y = stage.stageHeight;
  
 mountain= new Mountain();
 addChild(mountain);
 mountain.x = stage.stageWidth/2;
 mountain.y = stage.stageHeight/2;
  
 glowFilter = new GlowFilter(0xCC, 0.6, 30, 30, 
 3, 1);
 blurFilter = new BlurFilter(3,3,1);
 blurFilter2 = new BlurFilter(13,13,3);
 glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2, 1, 
 true);
  
 croix.filters = [blurFilter, glowFilter];
 croix2R.filters = croix2L.filters =[blurFilter2];
 sun.filters = [glowSun, blurFilter2];
  
 addEventListener(Event.ENTER_FRAME, onEnterFrame);
 }
 public function onEnterFrame(event:Event):void {
 //...
 }
  
 }
 }
   }
  
   Mountain class final:
  
   package {
 import flash.display.Sprite;
  
 public class Mountain extends Sprite {
 private var x0:Number =0;
 private var y0:Number =stage.stageHeight -150;
 private var x1:Number=stage.stageWidth/2;
 private var y1:Number=100;
 private var x2:Number =stage.stageWidth;
 private var y2:Number =stage.stageHeight -150;
  
 public function Mountain() {
 init();
 }
 public function init():void {
 graphics.beginFill(0x256251);
 graphics.moveTo(x0,y0);
 graphics.curveTo(x1,y1,x2,y2);
 graphics.lineTo(x2, stage.stageHeight);
 graphics.lineTo(0, stage.stageHeight);
 graphics.endFill();
 }
 }
   }
  
   On Mon, Mar 17, 2008 at 3:58 PM, jonathan howe [EMAIL PROTECTED]
wrote:
   Missing () after Mountain instantiation, first of all...
  
   var mountain:Mountain = new Mountain();
  
  
  
  
  
   On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec
   [EMAIL PROTECTED] wrote:
  
   Hi
   (posted in flashnewbies but the list is not very active and i need
   to
   solve this problemas soon as possible)
   i have a problem while creating a as3 short animation:
  
   When i test the movie(all done with as3) i get this:
  
   TypeError: Error #1009: Cannot access a property or method of a null
   object reference.
 at Mountain/init2()
 at Mountain$iinit()
 at RisingCroix/::init()
 at RisingCroix$iinit()
  
  
   my code:
   package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;
  
 public class RisingCroix extends Sprite {
 private var croix:Croix;
 private var croix2L:Croix2;
 private var croix2R:Croix2;
  
 private var 

Re: [Flashcoders] Error #1009

2008-03-17 Thread Cory Petosky
Jonathan, that's actually legal in ActionScript. Ugly and misleading, but legal.

Pedro, change Mountain2 to this:

 import flash.events.Event;
 import flash.display.Sprite;
 public class Mountain extends Sprite {
   private var color1:uint=0x003300;
   private var color2:uint=0x001700;

   public function Mountain() {
   addEventListener(Event.ADDED_TO_STAGE, stageListener);
   }
   public function stageListener(event:Event):void {

   graphics.beginFill(color1);
   graphics.drawRect(0,0,stage.stageWidth,
stage.stageHeight/2);
   graphics.endFill();
   }

You don't have a reference to the stage until the object is actually
added -- using an event listener to wait until you're added to the
stage solves the problem.


On 3/17/08, jonathan howe [EMAIL PROTECTED] wrote:
 Missing () after Mountain instantiation, first of all...

  var mountain:Mountain = new Mountain();




  On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec [EMAIL PROTECTED] wrote:

   Hi
(posted in flashnewbies but the list is not very active and i need to
   solve this problemas soon as possible)
i have a problem while creating a as3 short animation:
  
When i test the movie(all done with as3) i get this:
  
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
  at Mountain/init2()
  at Mountain$iinit()
  at RisingCroix/::init()
  at RisingCroix$iinit()
  
  
my code:
package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.filters.*;
  
  public class RisingCroix extends Sprite {
  private var croix:Croix;
  private var croix2L:Croix2;
  private var croix2R:Croix2;
  
  private var vy:Number=5;
  private var glowFilter:GlowFilter;
  private var blurFilter:BlurFilter;
  private var blurFilter2:BlurFilter;
  
  public function RisingCroix() {
  init();
  }
  private function init():void {
  croix=new Croix;
  addChild(croix);
  croix.x=stage.stageWidth / 2;
  croix.y=stage.stageHeight;
  
  croix2L = new Croix2;
  addChild(croix2L);
  croix2L.x=stage.stageWidth /4;
  croix2L.y = stage.stageHeight;
  
  croix2R = new Croix2;
  addChild(croix2R);
  croix2R.x = stage.stageWidth /4 *3;
  croix2R.y = stage.stageHeight;
  
  var mountain:Mountain = new Mountain //i guess
   it is here wher it stucks
  addChild(mountain);
  mountain.x = stage.stageWidth / 2;
  mountain.y = stage.stageHeight / 2;
  
  glowFilter = new GlowFilter(0x00, 0.6, 30,
   30, 2, 1);
  blurFilter = new BlurFilter(6,6,1);
  blurFilter2 = new BlurFilter(13,13,3);
  
  addEventListener(Event.ENTER_FRAME, onEnterFrame);
  }
  public function onEnterFrame(event:Event):void {
  if (croix.ystage.stageHeight/2) {
  croix.y -=vy;
  }
  if (croix2R.ystage.stageHeight/2-10) {
  croix2R.y -= vy/3*2;
  croix2L.y  -= vy/3*2;
  }
  croix.filters = [blurFilter, glowFilter];
  croix2R.filters = croix2L.filters =[blurFilter2];
  
  }
  }
}
  
and the Mountain CLass
  
package {
  import flash.display.Sprite;
  
  public class Mountain extends Sprite {
  private var color1:uint=0x003300;
  private var color2:uint=0x001700;
  
  public function Mountain() {
  init2();
  }
  public function init2():void {
  
  graphics.beginFill(color1);
  graphics.drawRect(0,0,stage.stageWidth,
   stage.stageHeight/2);
  graphics.endFill();
  }
  }
}
  
  
  
--
Pedro D.K.
   ___
   Flashcoders mailing list
   Flashcoders@chattyfig.figleaf.com
   http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
  




 --
  -jonathan howe :: 404.434.2321 :: 180 High St Apt 26 Portland, ME 04101

 

Re: [Flashcoders] Error #1009

2008-03-17 Thread Sidney de Koning

Just rewrite this:


package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;

 public class RisingCroix extends Sprite {
 private var croix:Croix;


to this:


package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;

import classpath.to.mountain.class.Mountain;



 public class RisingCroix extends Sprite {
 private var croix:Croix;


Then the datatype Mountain exists and your class will be available in  
this class.

Hope that works for you, let me know.

Cheers,

Sid

PS. Just a tip, its good practice to rename your private member  
variables (class variables: private var nameOfVar) with an underscore,  
like so: private var _nameOfVar so you can easily distinguish between  
class variables and local variables in functions or parameters.



On Mar 17, 2008, at 4:53 PM, Pedro Kostelec wrote:


NO , ihaven't. I am only in a learning process of as3, so if you can
help me importing a class

On Mon, Mar 17, 2008 at 4:35 PM, Sidney de Koning
[EMAIL PROTECTED] wrote:

Have you tried importing the Mountain Class?

Cheers,

Sid



On Mar 17, 2008, at 4:28 PM, Pedro Kostelec wrote:


I added the () to it but still doesn't work:

package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;

 public class RisingCroix extends Sprite {
 private var croix:Croix;
 private var croix2L:Croix2;
 private var croix2R:Croix2;
 private var sun:Sun;
 private var mountain:Mountain;

 private var vy:Number=5;
 private var glowFilter:GlowFilter;
 private var glowSun:GlowFilter;
 private var blurFilter:BlurFilter;
 private var blurFilter2:BlurFilter;

 public function RisingCroix() {
 init();
 }
 private function init():void {
 sun = new Sun();
 addChild(sun);
 sun.x = stage.stageWidth / 2;
 sun.y=stage.stageHeight;

 croix=new Croix();
 addChild(croix);
 croix.x=stage.stageWidth / 2;
 croix.y=stage.stageHeight;

 croix2L = new Croix2();
 addChild(croix2L);
 croix2L.x=stage.stageWidth /4;
 croix2L.y = stage.stageHeight;

 croix2R = new Croix2();
 addChild(croix2R);
 croix2R.x = stage.stageWidth /4 *3;
 croix2R.y = stage.stageHeight;

 mountain= new Mountain();
 addChild(mountain);
 mountain.x = stage.stageWidth/2;
 mountain.y = stage.stageHeight/2;

 glowFilter = new GlowFilter(0xCC, 0.6,  
30, 30, 3, 1);

 blurFilter = new BlurFilter(3,3,1);
 blurFilter2 = new BlurFilter(13,13,3);
 glowSun = new GlowFilter(0xFF6600, 1, 50, 50,  
2, 1, true);


 croix.filters = [blurFilter, glowFilter];
 croix2R.filters = croix2L.filters  
=[blurFilter2];

 sun.filters = [glowSun, blurFilter2];

 addEventListener(Event.ENTER_FRAME,  
onEnterFrame);

 }
 public function onEnterFrame(event:Event):void {
 //...
 }

 }
 }
}

Mountain class final:

package {
 import flash.display.Sprite;

 public class Mountain extends Sprite {
 private var x0:Number =0;
 private var y0:Number =stage.stageHeight -150;
 private var x1:Number=stage.stageWidth/2;
 private var y1:Number=100;
 private var x2:Number =stage.stageWidth;
 private var y2:Number =stage.stageHeight -150;

 public function Mountain() {
 init();
 }
 public function init():void {
 graphics.beginFill(0x256251);
 graphics.moveTo(x0,y0);
 graphics.curveTo(x1,y1,x2,y2);
 graphics.lineTo(x2, stage.stageHeight);
 graphics.lineTo(0, stage.stageHeight);
 graphics.endFill();
 }
 }
}

On Mon, Mar 17, 2008 at 3:58 PM, jonathan howe [EMAIL PROTECTED]

wrote:
Missing () after Mountain instantiation, first of all...

var mountain:Mountain = new Mountain();





On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec
[EMAIL PROTECTED] wrote:


Hi
(posted in flashnewbies but the list is not very active and i need
to
solve this problemas soon as possible)
i have a problem while creating a as3 short animation:

When i test the movie(all done with as3) i get this:

TypeError: Error 

Re: [Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
I doesn't. I posted the iles on the net.
Can you please throw a look at?
http://www.box.net/shared/wettvhs84s

Thanks

On Mon, Mar 17, 2008 at 4:50 PM, Cory Petosky
[EMAIL PROTECTED] wrote:
 Jonathan, that's actually legal in ActionScript. Ugly and misleading, but 
 legal.

  Pedro, change Mountain2 to this:

  import flash.events.Event;

  import flash.display.Sprite;
  public class Mountain extends Sprite {
private var color1:uint=0x003300;
private var color2:uint=0x001700;

public function Mountain() {
addEventListener(Event.ADDED_TO_STAGE, stageListener);
}
public function stageListener(event:Event):void {


graphics.beginFill(color1);
graphics.drawRect(0,0,stage.stageWidth,
  stage.stageHeight/2);
graphics.endFill();
}

  You don't have a reference to the stage until the object is actually
  added -- using an event listener to wait until you're added to the
  stage solves the problem.




  On 3/17/08, jonathan howe [EMAIL PROTECTED] wrote:
   Missing () after Mountain instantiation, first of all...
  
var mountain:Mountain = new Mountain();
  
  
  
  
On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec [EMAIL PROTECTED] wrote:
  
 Hi
  (posted in flashnewbies but the list is not very active and i need to
 solve this problemas soon as possible)
  i have a problem while creating a as3 short animation:

  When i test the movie(all done with as3) i get this:

  TypeError: Error #1009: Cannot access a property or method of a null
  object reference.
at Mountain/init2()
at Mountain$iinit()
at RisingCroix/::init()
at RisingCroix$iinit()


  my code:
  package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;

private var vy:Number=5;
private var glowFilter:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
croix=new Croix;
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2;
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2;
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

var mountain:Mountain = new Mountain //i guess
 it is here wher it stucks
addChild(mountain);
mountain.x = stage.stageWidth / 2;
mountain.y = stage.stageHeight / 2;

glowFilter = new GlowFilter(0x00, 0.6, 30,
 30, 2, 1);
blurFilter = new BlurFilter(6,6,1);
blurFilter2 = new BlurFilter(13,13,3);

addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
}
public function onEnterFrame(event:Event):void {
if (croix.ystage.stageHeight/2) {
croix.y -=vy;
}
if (croix2R.ystage.stageHeight/2-10) {
croix2R.y -= vy/3*2;
croix2L.y  -= vy/3*2;
}
croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters =[blurFilter2];

}
}
  }

  and the Mountain CLass

  package {
import flash.display.Sprite;

public class Mountain extends Sprite {
private var color1:uint=0x003300;
private var color2:uint=0x001700;

public function Mountain() {
init2();
}
public function init2():void {

graphics.beginFill(color1);

Re: [Flashcoders] Error #1009

2008-03-17 Thread Jason Van Cleave
you can't reference the stage in the Mountain class until it is added to the
Display List. try this

package {
   import flash.display.Sprite;
import flash.events.Event;

   public class Mountain extends Sprite {
   private var x0:Number;
   private var y0:Number;
   private var x1:Number;
   private var y1:Number;
   private var x2:Number;
   private var y2:Number;

   public function Mountain() {
   this.addEventListener(Event.ADDED_TO_STAGE, onStageAdded);


   }
   public function init():void {
   graphics.beginFill(0x256251);
   graphics.moveTo(x0,y0);
   graphics.curveTo(x1,y1,x2,y2);
   graphics.lineTo(x2, stage.stageHeight);
   graphics.lineTo(0, stage.stageHeight);
   graphics.endFill();
   }
   public function onStageAdded(e:Event):void
   {
   x0:Number =0;
  y0 =stage.stageHeight -150;
   x1=stage.stageWidth/2;
  y1:Number=100;
   x2 =stage.stageWidth;
   y2:Number =stage.stageHeight -150;
   init();

  }
 }

On Mon, Mar 17, 2008 at 11:28 AM, Pedro Kostelec [EMAIL PROTECTED]
wrote:

 I added the () to it but still doesn't work:

 package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;
 private var sun:Sun;
private var mountain:Mountain;

private var vy:Number=5;
private var glowFilter:GlowFilter;
 private var glowSun:GlowFilter;
 private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
 sun = new Sun();
addChild(sun);
sun.x = stage.stageWidth / 2;
sun.y=stage.stageHeight;

croix=new Croix();
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2();
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2();
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

 mountain= new Mountain();
 addChild(mountain);
mountain.x = stage.stageWidth/2;
mountain.y = stage.stageHeight/2;

 glowFilter = new GlowFilter(0xCC, 0.6, 30, 30,
 3, 1);
blurFilter = new BlurFilter(3,3,1);
 blurFilter2 = new BlurFilter(13,13,3);
 glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2,
 1, true);

croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters =[blurFilter2];
 sun.filters = [glowSun, blurFilter2];

addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void {
 //...
}

}
}
 }

 Mountain class final:

 package {
import flash.display.Sprite;

public class Mountain extends Sprite {
 private var x0:Number =0;
private var y0:Number =stage.stageHeight -150;
private var x1:Number=stage.stageWidth/2;
private var y1:Number=100;
private var x2:Number =stage.stageWidth;
private var y2:Number =stage.stageHeight -150;

public function Mountain() {
init();
}
public function init():void {
graphics.beginFill(0x256251);
graphics.moveTo(x0,y0);
graphics.curveTo(x1,y1,x2,y2);
graphics.lineTo(x2, stage.stageHeight);
graphics.lineTo(0, stage.stageHeight);
graphics.endFill();
 }
}
 }

 On Mon, Mar 17, 2008 at 3:58 PM, jonathan howe [EMAIL PROTECTED]
 

Re: [Flashcoders] Error #1009

2008-03-17 Thread jonathan howe
Hi, Cory,

That is really interesting. I played with it a little and I got this
Warning:

Warning: 3553: Function value used where type void was expected.  Possibly
the parentheses () are missing after this function reference.
and of course it threw an actual error when I set up the function with
arguments.
I wonder if there is some sort of precedent/reasoning for that working... If
you write something like this, it behaves like almost like a property:

function stuff():int {

return 1;
}
var a = stuff;

but this:

function stuff():int {

return 1;
}
stuff;

shows that warning.

Anyway, it's curious and thanks for setting me straight!

-jonathan


On Mon, Mar 17, 2008 at 5:25 PM, Pedro Kostelec [EMAIL PROTECTED] wrote:

 I doesn't. I posted the iles on the net.
 Can you please throw a look at?
 http://www.box.net/shared/wettvhs84s

 Thanks

 On Mon, Mar 17, 2008 at 4:50 PM, Cory Petosky
 [EMAIL PROTECTED] wrote:
  Jonathan, that's actually legal in ActionScript. Ugly and misleading,
 but legal.
 
   Pedro, change Mountain2 to this:
 
   import flash.events.Event;
 
   import flash.display.Sprite;
   public class Mountain extends Sprite {
 private var color1:uint=0x003300;
 private var color2:uint=0x001700;
 
 public function Mountain() {
 addEventListener(Event.ADDED_TO_STAGE,
 stageListener);
 }
 public function stageListener(event:Event):void {
 
 
 graphics.beginFill(color1);
 graphics.drawRect(0,0,stage.stageWidth,
   stage.stageHeight/2);
 graphics.endFill();
 }
 
   You don't have a reference to the stage until the object is actually
   added -- using an event listener to wait until you're added to the
   stage solves the problem.
  
 
 
 
   On 3/17/08, jonathan howe [EMAIL PROTECTED] wrote:
Missing () after Mountain instantiation, first of all...
   
 var mountain:Mountain = new Mountain();
   
   
   
   
 On Mon, Mar 17, 2008 at 3:36 PM, Pedro Kostelec [EMAIL PROTECTED]
 wrote:
   
  Hi
   (posted in flashnewbies but the list is not very active and i
 need to
  solve this problemas soon as possible)
   i have a problem while creating a as3 short animation:
 
   When i test the movie(all done with as3) i get this:
 
   TypeError: Error #1009: Cannot access a property or method of a
 null
   object reference.
 at Mountain/init2()
 at Mountain$iinit()
 at RisingCroix/::init()
 at RisingCroix$iinit()
 
 
   my code:
   package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;
 
 public class RisingCroix extends Sprite {
 private var croix:Croix;
 private var croix2L:Croix2;
 private var croix2R:Croix2;
 
 private var vy:Number=5;
 private var glowFilter:GlowFilter;
 private var blurFilter:BlurFilter;
 private var blurFilter2:BlurFilter;
 
 public function RisingCroix() {
 init();
 }
 private function init():void {
 croix=new Croix;
 addChild(croix);
 croix.x=stage.stageWidth / 2;
 croix.y=stage.stageHeight;
 
 croix2L = new Croix2;
 addChild(croix2L);
 croix2L.x=stage.stageWidth /4;
 croix2L.y = stage.stageHeight;
 
 croix2R = new Croix2;
 addChild(croix2R);
 croix2R.x = stage.stageWidth /4 *3;
 croix2R.y = stage.stageHeight;
 
 var mountain:Mountain = new Mountain //i
 guess
  it is here wher it stucks
 addChild(mountain);
 mountain.x = stage.stageWidth / 2;
 mountain.y = stage.stageHeight / 2;
 
 glowFilter = new GlowFilter(0x00, 0.6,
 30,
  30, 2, 1);
 blurFilter = new BlurFilter(6,6,1);
 blurFilter2 = new BlurFilter(13,13,3);
 
 addEventListener(Event.ENTER_FRAME,
 onEnterFrame);
 }
 public function onEnterFrame(event:Event):void {
 if (croix.ystage.stageHeight/2) {
 croix.y -=vy;
 }
 if (croix2R.ystage.stageHeight/2-10) {
 

Re: [Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
Joson, i tried yours too.

I had to add var x0:Number and so on... (The var was missing)
But it hasn't worked neither. Well i get no more error but the sprite
isn't drawn



On Mon, Mar 17, 2008 at 5:14 PM, Jason Van Cleave
[EMAIL PROTECTED] wrote:
 you can't reference the stage in the Mountain class until it is added to the
  Display List. try this


  package {
import flash.display.Sprite;
  import flash.events.Event;


public class Mountain extends Sprite {
private var x0:Number;
private var y0:Number;
private var x1:Number;
private var y1:Number;
private var x2:Number;
private var y2:Number;

public function Mountain() {
this.addEventListener(Event.ADDED_TO_STAGE, onStageAdded);



}
public function init():void {
graphics.beginFill(0x256251);
graphics.moveTo(x0,y0);
graphics.curveTo(x1,y1,x2,y2);
graphics.lineTo(x2, stage.stageHeight);
graphics.lineTo(0, stage.stageHeight);
graphics.endFill();
}
public function onStageAdded(e:Event):void
{
x0:Number =0;
   y0 =stage.stageHeight -150;
x1=stage.stageWidth/2;
   y1:Number=100;
x2 =stage.stageWidth;

y2:Number =stage.stageHeight -150;
init();

   }
   }

  On Mon, Mar 17, 2008 at 11:28 AM, Pedro Kostelec [EMAIL PROTECTED]


 wrote:

   I added the () to it but still doesn't work:
  
   package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.filters.*;
  
  public class RisingCroix extends Sprite {
  private var croix:Croix;
  private var croix2L:Croix2;
  private var croix2R:Croix2;
   private var sun:Sun;
  private var mountain:Mountain;
  
  private var vy:Number=5;
  private var glowFilter:GlowFilter;
   private var glowSun:GlowFilter;
   private var blurFilter:BlurFilter;
  private var blurFilter2:BlurFilter;
  
  public function RisingCroix() {
  init();
  }
  private function init():void {
   sun = new Sun();
  addChild(sun);
  sun.x = stage.stageWidth / 2;
  sun.y=stage.stageHeight;
  
  croix=new Croix();
  addChild(croix);
  croix.x=stage.stageWidth / 2;
  croix.y=stage.stageHeight;
  
  croix2L = new Croix2();
  addChild(croix2L);
  croix2L.x=stage.stageWidth /4;
  croix2L.y = stage.stageHeight;
  
  croix2R = new Croix2();
  addChild(croix2R);
  croix2R.x = stage.stageWidth /4 *3;
  croix2R.y = stage.stageHeight;
  
   mountain= new Mountain();
   addChild(mountain);
  mountain.x = stage.stageWidth/2;
  mountain.y = stage.stageHeight/2;
  
   glowFilter = new GlowFilter(0xCC, 0.6, 30, 30,
   3, 1);
  blurFilter = new BlurFilter(3,3,1);
   blurFilter2 = new BlurFilter(13,13,3);
   glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2,
   1, true);
  
  croix.filters = [blurFilter, glowFilter];
  croix2R.filters = croix2L.filters =[blurFilter2];
   sun.filters = [glowSun, blurFilter2];
  
  addEventListener(Event.ENTER_FRAME, onEnterFrame);
  }
  public function onEnterFrame(event:Event):void {
   //...
  }
  
  }
  }
   }
  
   Mountain class final:
  
   package {
  import flash.display.Sprite;
  
  public class Mountain extends Sprite {
   private var x0:Number =0;
  private var y0:Number =stage.stageHeight -150;
  private var x1:Number=stage.stageWidth/2;
  private var y1:Number=100;
  private var x2:Number =stage.stageWidth;
  private var y2:Number =stage.stageHeight -150;
  
  public function Mountain() {
  init();
  }
 

Re: [Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
I tried import Mountain; and import com.Mountain but it hasn't worked.
Always get the same error

I supose there is no path if the files are in the same folder,no?

On Mon, Mar 17, 2008 at 5:15 PM, Sidney de Koning
[EMAIL PROTECTED] wrote:
 Just rewrite this:


   package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;
  
public class RisingCroix extends Sprite {
private var croix:Croix;

  to this:


   package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;
  import classpath.to.mountain.class.Mountain;

 
  
public class RisingCroix extends Sprite {
private var croix:Croix;

  Then the datatype Mountain exists and your class will be available in
  this class.
  Hope that works for you, let me know.

  Cheers,

  Sid

  PS. Just a tip, its good practice to rename your private member
  variables (class variables: private var nameOfVar) with an underscore,
  like so: private var _nameOfVar so you can easily distinguish between
  class variables and local variables in functions or parameters.




  On Mar 17, 2008, at 4:53 PM, Pedro Kostelec wrote:

   NO , ihaven't. I am only in a learning process of as3, so if you can
   help me importing a class
  
   On Mon, Mar 17, 2008 at 4:35 PM, Sidney de Koning
   [EMAIL PROTECTED] wrote:
   Have you tried importing the Mountain Class?
  
   Cheers,
  
   Sid
  
  
  
   On Mar 17, 2008, at 4:28 PM, Pedro Kostelec wrote:
  
   I added the () to it but still doesn't work:
  
   package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;
  
public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;
private var sun:Sun;
private var mountain:Mountain;
  
private var vy:Number=5;
private var glowFilter:GlowFilter;
private var glowSun:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;
  
public function RisingCroix() {
init();
}
private function init():void {
sun = new Sun();
addChild(sun);
sun.x = stage.stageWidth / 2;
sun.y=stage.stageHeight;
  
croix=new Croix();
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;
  
croix2L = new Croix2();
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;
  
croix2R = new Croix2();
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;
  
mountain= new Mountain();
addChild(mountain);
mountain.x = stage.stageWidth/2;
mountain.y = stage.stageHeight/2;
  
glowFilter = new GlowFilter(0xCC, 0.6,
   30, 30, 3, 1);
blurFilter = new BlurFilter(3,3,1);
blurFilter2 = new BlurFilter(13,13,3);
glowSun = new GlowFilter(0xFF6600, 1, 50, 50,
   2, 1, true);
  
croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters
   =[blurFilter2];
sun.filters = [glowSun, blurFilter2];
  
addEventListener(Event.ENTER_FRAME,
   onEnterFrame);
}
public function onEnterFrame(event:Event):void {
//...
}
  
}
}
   }
  
   Mountain class final:
  
   package {
import flash.display.Sprite;
  
public class Mountain extends Sprite {
private var x0:Number =0;
private var y0:Number =stage.stageHeight -150;
private var x1:Number=stage.stageWidth/2;
private var y1:Number=100;
private var x2:Number =stage.stageWidth;
private var y2:Number =stage.stageHeight -150;
  
public function Mountain() {
init();
}
public function init():void {
graphics.beginFill(0x256251);
graphics.moveTo(x0,y0);
graphics.curveTo(x1,y1,x2,y2);
graphics.lineTo(x2, stage.stageHeight);

Re: [Flashcoders] Error #1009

2008-03-17 Thread Sidney de Koning
I think that in AS3, there is  only one file that can exsist in the  
'root' of the package, the only entry point you have for a  
application. The rest has to live in packages. Most of the time you  
call this class 'Main'. And use it as your document class or  
instanciate it on the timeline, then you place all your other files in  
packages and reference them i Main where you have to.

so like this (read this like a directory structure)

root folder: Main  (- class files)
package: com.something.Mountain (- class files)
package: com.something.RisingCroix  (- class files)

etc.

And in Main you reference your imports like import  
com.something.ClassName.


I hope it is clear for you. Do you understand?

Cheers,

Sid

On Mar 17, 2008, at 5:46 PM, Pedro Kostelec wrote:


I tried import Mountain; and import com.Mountain but it hasn't worked.
Always get the same error

I supose there is no path if the files are in the same folder,no?

On Mon, Mar 17, 2008 at 5:15 PM, Sidney de Koning
[EMAIL PROTECTED] wrote:

Just rewrite this:



package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;


to this:



package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

import classpath.to.mountain.class.Mountain;




public class RisingCroix extends Sprite {
private var croix:Croix;


Then the datatype Mountain exists and your class will be available in
this class.
Hope that works for you, let me know.

Cheers,

Sid

PS. Just a tip, its good practice to rename your private member
variables (class variables: private var nameOfVar) with an  
underscore,

like so: private var _nameOfVar so you can easily distinguish between
class variables and local variables in functions or parameters.




On Mar 17, 2008, at 4:53 PM, Pedro Kostelec wrote:


NO , ihaven't. I am only in a learning process of as3, so if you can
help me importing a class

On Mon, Mar 17, 2008 at 4:35 PM, Sidney de Koning
[EMAIL PROTECTED] wrote:

Have you tried importing the Mountain Class?

Cheers,

Sid



On Mar 17, 2008, at 4:28 PM, Pedro Kostelec wrote:


I added the () to it but still doesn't work:

package {
import flash.display.Sprite;
import flash.events.Event;
import flash.filters.*;

public class RisingCroix extends Sprite {
private var croix:Croix;
private var croix2L:Croix2;
private var croix2R:Croix2;
private var sun:Sun;
private var mountain:Mountain;

private var vy:Number=5;
private var glowFilter:GlowFilter;
private var glowSun:GlowFilter;
private var blurFilter:BlurFilter;
private var blurFilter2:BlurFilter;

public function RisingCroix() {
init();
}
private function init():void {
sun = new Sun();
addChild(sun);
sun.x = stage.stageWidth / 2;
sun.y=stage.stageHeight;

croix=new Croix();
addChild(croix);
croix.x=stage.stageWidth / 2;
croix.y=stage.stageHeight;

croix2L = new Croix2();
addChild(croix2L);
croix2L.x=stage.stageWidth /4;
croix2L.y = stage.stageHeight;

croix2R = new Croix2();
addChild(croix2R);
croix2R.x = stage.stageWidth /4 *3;
croix2R.y = stage.stageHeight;

mountain= new Mountain();
addChild(mountain);
mountain.x = stage.stageWidth/2;
mountain.y = stage.stageHeight/2;

glowFilter = new GlowFilter(0xCC, 0.6,
30, 30, 3, 1);
blurFilter = new BlurFilter(3,3,1);
blurFilter2 = new BlurFilter(13,13,3);
glowSun = new GlowFilter(0xFF6600, 1, 50, 50,
2, 1, true);

croix.filters = [blurFilter, glowFilter];
croix2R.filters = croix2L.filters
=[blurFilter2];
sun.filters = [glowSun, blurFilter2];

addEventListener(Event.ENTER_FRAME,
onEnterFrame);
}
public function onEnterFrame(event:Event):void {
//...
}

}
}
}

Mountain class final:

package {
import flash.display.Sprite;

public class Mountain extends Sprite {
private var x0:Number =0;
private var y0:Number =stage.stageHeight -150;
private var x1:Number=stage.stageWidth/2;
private var y1:Number=100;
private var x2:Number =stage.stageWidth;
private var y2:Number =stage.stageHeight -150;


Re: [Flashcoders] Error #1009

2008-03-17 Thread Sidney de Koning
Start tracing out the variables, because there is a variable undefined  
or null and you try to perform an operation on it. Since its undefined  
or null the operation halts.


It can also be that your function init2 does not return void but  
returns a sprite.

On Mar 17, 2008, at 5:47 PM, Pedro Kostelec wrote:


Joson, i tried yours too.

I had to add var x0:Number and so on... (The var was missing)
But it hasn't worked neither. Well i get no more error but the sprite
isn't drawn



On Mon, Mar 17, 2008 at 5:14 PM, Jason Van Cleave
[EMAIL PROTECTED] wrote:
you can't reference the stage in the Mountain class until it is  
added to the

Display List. try this


package {
  import flash.display.Sprite;
import flash.events.Event;


  public class Mountain extends Sprite {
  private var x0:Number;
  private var y0:Number;
  private var x1:Number;
  private var y1:Number;
  private var x2:Number;
  private var y2:Number;

  public function Mountain() {
  this.addEventListener(Event.ADDED_TO_STAGE,  
onStageAdded);




  }
  public function init():void {
  graphics.beginFill(0x256251);
  graphics.moveTo(x0,y0);
  graphics.curveTo(x1,y1,x2,y2);
  graphics.lineTo(x2, stage.stageHeight);
  graphics.lineTo(0, stage.stageHeight);
  graphics.endFill();
  }
  public function onStageAdded(e:Event):void
  {
  x0:Number =0;
 y0 =stage.stageHeight -150;
  x1=stage.stageWidth/2;
 y1:Number=100;
  x2 =stage.stageWidth;

  y2:Number =stage.stageHeight -150;
  init();

 }
 }

On Mon, Mar 17, 2008 at 11:28 AM, Pedro Kostelec  
[EMAIL PROTECTED]



wrote:


I added the () to it but still doesn't work:

package {
  import flash.display.Sprite;
  import flash.events.Event;
  import flash.filters.*;

  public class RisingCroix extends Sprite {
  private var croix:Croix;
  private var croix2L:Croix2;
  private var croix2R:Croix2;
   private var sun:Sun;
  private var mountain:Mountain;

  private var vy:Number=5;
  private var glowFilter:GlowFilter;
   private var glowSun:GlowFilter;
   private var blurFilter:BlurFilter;
  private var blurFilter2:BlurFilter;

  public function RisingCroix() {
  init();
  }
  private function init():void {
   sun = new Sun();
  addChild(sun);
  sun.x = stage.stageWidth / 2;
  sun.y=stage.stageHeight;

  croix=new Croix();
  addChild(croix);
  croix.x=stage.stageWidth / 2;
  croix.y=stage.stageHeight;

  croix2L = new Croix2();
  addChild(croix2L);
  croix2L.x=stage.stageWidth /4;
  croix2L.y = stage.stageHeight;

  croix2R = new Croix2();
  addChild(croix2R);
  croix2R.x = stage.stageWidth /4 *3;
  croix2R.y = stage.stageHeight;

   mountain= new Mountain();
   addChild(mountain);
  mountain.x = stage.stageWidth/2;
  mountain.y = stage.stageHeight/2;

   glowFilter = new GlowFilter(0xCC, 0.6,  
30, 30,

3, 1);
  blurFilter = new BlurFilter(3,3,1);
   blurFilter2 = new BlurFilter(13,13,3);
   glowSun = new GlowFilter(0xFF6600, 1, 50,  
50, 2,

1, true);

  croix.filters = [blurFilter, glowFilter];
  croix2R.filters = croix2L.filters  
=[blurFilter2];

   sun.filters = [glowSun, blurFilter2];

  addEventListener(Event.ENTER_FRAME,  
onEnterFrame);

  }
  public function onEnterFrame(event:Event):void {
   //...
  }

  }
  }
}

Mountain class final:

package {
  import flash.display.Sprite;

  public class Mountain extends Sprite {
   private var x0:Number =0;
  private var y0:Number =stage.stageHeight -150;
  private var x1:Number=stage.stageWidth/2;
  private var y1:Number=100;
  private var x2:Number =stage.stageWidth;
  private var y2:Number =stage.stageHeight -150;

  public function Mountain() {
  init();
  }
  public function init():void {
  

Re: [Flashcoders] Error #1009

2008-03-17 Thread Jason Van Cleave
some typos in there (coding in gmail)

public function onStageAdded(e:Event):void
 {
x0 =0;
y0 =stage.stageHeight -150;
x1=stage.stageWidth/2;
y1=100;
x2 =stage.stageWidth;
 y2 =stage.stageHeight -150;
 init();

  }

On Mon, Mar 17, 2008 at 12:14 PM, Jason Van Cleave [EMAIL PROTECTED]
wrote:

 you can't reference the stage in the Mountain class until it is added to
 the Display List. try this

 package {
import flash.display.Sprite;
 import flash.events.Event;

public class Mountain extends Sprite {
private var x0:Number;
private var y0:Number;
private var x1:Number;
private var y1:Number;
private var x2:Number;
private var y2:Number;

public function Mountain() {
this.addEventListener(Event.ADDED_TO_STAGE, onStageAdded);


}
public function init():void {
graphics.beginFill(0x256251);
graphics.moveTo(x0,y0);
graphics.curveTo(x1,y1,x2,y2);
graphics.lineTo(x2, stage.stageHeight);
graphics.lineTo(0, stage.stageHeight);
graphics.endFill();
}
public function onStageAdded(e:Event):void
{
x0:Number =0;
   y0 =stage.stageHeight -150;
x1=stage.stageWidth/2;
   y1:Number=100;
x2 =stage.stageWidth;
y2:Number =stage.stageHeight -150;
init();


   }
  }

 On Mon, Mar 17, 2008 at 11:28 AM, Pedro Kostelec [EMAIL PROTECTED]
 wrote:

  I added the () to it but still doesn't work:
 
  package {
 import flash.display.Sprite;
 import flash.events.Event;
 import flash.filters.*;
 
 public class RisingCroix extends Sprite {
 private var croix:Croix;
 private var croix2L:Croix2;
 private var croix2R:Croix2;
  private var sun:Sun;
 private var mountain:Mountain;
 
 private var vy:Number=5;
 private var glowFilter:GlowFilter;
  private var glowSun:GlowFilter;
  private var blurFilter:BlurFilter;
 private var blurFilter2:BlurFilter;
 
 public function RisingCroix() {
 init();
 }
 private function init():void {
  sun = new Sun();
 addChild(sun);
 sun.x = stage.stageWidth / 2;
 sun.y=stage.stageHeight;
 
 croix=new Croix();
 addChild(croix);
 croix.x=stage.stageWidth / 2;
 croix.y=stage.stageHeight;
 
 croix2L = new Croix2();
 addChild(croix2L);
 croix2L.x=stage.stageWidth /4;
 croix2L.y = stage.stageHeight;
 
 croix2R = new Croix2();
 addChild(croix2R);
 croix2R.x = stage.stageWidth /4 *3;
 croix2R.y = stage.stageHeight;
 
  mountain= new Mountain();
  addChild(mountain);
 mountain.x = stage.stageWidth/2;
 mountain.y = stage.stageHeight/2;
 
  glowFilter = new GlowFilter(0xCC, 0.6, 30,
  30, 3, 1);
 blurFilter = new BlurFilter(3,3,1);
  blurFilter2 = new BlurFilter(13,13,3);
  glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2,
  1, true);
 
 croix.filters = [blurFilter, glowFilter];
 croix2R.filters = croix2L.filters =[blurFilter2];
  sun.filters = [glowSun, blurFilter2];
 
 addEventListener(Event.ENTER_FRAME,
  onEnterFrame);
 }
 public function onEnterFrame(event:Event):void {
  //...
 }
 
 }
 }
  }
 
  Mountain class final:
 
  package {
 import flash.display.Sprite;
 
 public class Mountain extends Sprite {
  private var x0:Number =0;
 private var y0:Number =stage.stageHeight -150;
 private var x1:Number=stage.stageWidth/2;
 private var y1:Number=100;
 private var x2:Number =stage.stageWidth;
 private var y2:Number =stage.stageHeight -150;
 
 public function Mountain() {
 init();
 }
 public 

Re: [Flashcoders] Error #1009

2008-03-17 Thread Steven Sacks
It is exceedingly rare that the compiler is telling you something is 
wrong that isn't.  If you're getting an error thrown, like it or not, 
you made a mistake somewhere.  Flash does what you tell it to do.


Unfortunately, it's not always easy to figure out where the error is 
coming from if you don't use the debugging tools provided.  Using try 
catch and throwing meaningful error messages will help you debug much 
more quickly.


If you're getting null pointer exceptions, you're experiencing the 
growing pains of going from AS1 to AS3.  It'll take time, but the more 
you get burned by them, the more your code will account for them and the 
less you'll have to deal with them.

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] Error #1009

2008-03-17 Thread Pedro Kostelec
Jason IT WORKED

Thanks to you and to all that took the time reply.

//
root folder: Main  (- class files)
package: com.something.Mountain (- class files)
package: com.something.RisingCroix  (- class files)
//
ISOrry don't really get it. Is com actually a file?
On Mon, Mar 17, 2008 at 5:18 PM, Jason Van Cleave
[EMAIL PROTECTED] wrote:
 some typos in there (coding in gmail)


  public function onStageAdded(e:Event):void
   {
 x0 =0;

 y0 =stage.stageHeight -150;
 x1=stage.stageWidth/2;
 y1=100;
 x2 =stage.stageWidth;
  y2 =stage.stageHeight -150;
  init();

   }

  On Mon, Mar 17, 2008 at 12:14 PM, Jason Van Cleave [EMAIL PROTECTED]
  wrote:



   you can't reference the stage in the Mountain class until it is added to
   the Display List. try this
  
   package {
  import flash.display.Sprite;
   import flash.events.Event;
  
  public class Mountain extends Sprite {
  private var x0:Number;
  private var y0:Number;
  private var x1:Number;
  private var y1:Number;
  private var x2:Number;
  private var y2:Number;
  
  public function Mountain() {
  this.addEventListener(Event.ADDED_TO_STAGE, onStageAdded);
  
  
  }
  public function init():void {
  graphics.beginFill(0x256251);
  graphics.moveTo(x0,y0);
  graphics.curveTo(x1,y1,x2,y2);
  graphics.lineTo(x2, stage.stageHeight);
  graphics.lineTo(0, stage.stageHeight);
  graphics.endFill();
  }
  public function onStageAdded(e:Event):void
  {
  x0:Number =0;
 y0 =stage.stageHeight -150;
  x1=stage.stageWidth/2;
 y1:Number=100;
  x2 =stage.stageWidth;
  y2:Number =stage.stageHeight -150;
  init();
  
  
 }
}
  
   On Mon, Mar 17, 2008 at 11:28 AM, Pedro Kostelec [EMAIL PROTECTED]
   wrote:
  
I added the () to it but still doesn't work:
   
package {
   import flash.display.Sprite;
   import flash.events.Event;
   import flash.filters.*;
   
   public class RisingCroix extends Sprite {
   private var croix:Croix;
   private var croix2L:Croix2;
   private var croix2R:Croix2;
private var sun:Sun;
   private var mountain:Mountain;
   
   private var vy:Number=5;
   private var glowFilter:GlowFilter;
private var glowSun:GlowFilter;
private var blurFilter:BlurFilter;
   private var blurFilter2:BlurFilter;
   
   public function RisingCroix() {
   init();
   }
   private function init():void {
sun = new Sun();
   addChild(sun);
   sun.x = stage.stageWidth / 2;
   sun.y=stage.stageHeight;
   
   croix=new Croix();
   addChild(croix);
   croix.x=stage.stageWidth / 2;
   croix.y=stage.stageHeight;
   
   croix2L = new Croix2();
   addChild(croix2L);
   croix2L.x=stage.stageWidth /4;
   croix2L.y = stage.stageHeight;
   
   croix2R = new Croix2();
   addChild(croix2R);
   croix2R.x = stage.stageWidth /4 *3;
   croix2R.y = stage.stageHeight;
   
mountain= new Mountain();
addChild(mountain);
   mountain.x = stage.stageWidth/2;
   mountain.y = stage.stageHeight/2;
   
glowFilter = new GlowFilter(0xCC, 0.6, 30,
30, 3, 1);
   blurFilter = new BlurFilter(3,3,1);
blurFilter2 = new BlurFilter(13,13,3);
glowSun = new GlowFilter(0xFF6600, 1, 50, 50, 2,
1, true);
   
   croix.filters = [blurFilter, glowFilter];
   croix2R.filters = croix2L.filters =[blurFilter2];
sun.filters = [glowSun, blurFilter2];
   
   addEventListener(Event.ENTER_FRAME,
onEnterFrame);
   }
   public function onEnterFrame(event:Event):void {
//...
   }
   
   }
   }
}