List Info

Thread: Navigating with OOP




Navigating with OOP
country flaguser name
United States
2007-07-28 14:37:23
I'm a little stumped. I'm getting some odd behavior, and I'm
not sure why.

I have this code in the first frame of my main timeline:

stop();

var DreamWeaverRoot = this;
var NextPgBtn:Navigator =
Navitagor(DreamWeaverRoot.attachMovie("NextButtonSymbol
", "Navigator",
DreamWeaverRoot.getNextHighestDepth()));
NextPgBtn.init(652, 546, DreamWeaverRoot);

I have a movie clip in the library named
"NextButton_mc". It's just a simple
clip with "up" and "over" labels, and a
stop(); action on the first frame of
each section.

I have an init() function in my Navigator class, but it is
never being
called, and the movie clip is left in the upper left corner.
Any idea why?

Here is the class:

class Navigator extends MovieClip
{
	private static var pages:Array = [1, 2, 3, 4, 5, 6];
	private var currentPage:Number;
	private var clipRoot_mc:MovieClip;
	
	public function init (x:Number, y:Number,
movieRoot:MovieClip):Void
	{
		currentPage = pages[0];
		this._x = x;
		this._y = y;
		clipRoot_mc = movieRoot;
	}
	
	function onRelease ()
	{
		if (currentPage < pages.length)
		{
			currentPage ++;
			clipRoot_mc.gotoAndStop ("page" +
pages[currentPage]);
		}
	}
	
	function onRollOver()
	{
		this.gotoAndStop ("Over");
	}
	
		function onRollOut()
	{
		this.gotoAndStop ("Up");
	}
}

BTW, the button responds to the RollOver and RollOut
events.

Cordially,

Kerry Thompson


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

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

RE: Navigating with OOP
country flaguser name
Switzerland
2007-07-28 14:51:19
Try

var NextPgBtn:Navigator =
DreamWeaverRoot.attachMovie("NextButtonSymbol",
"Navigator",
DreamWeaverRoot.getNextHighestDepth());

hth
-------------
Andreas Weber


-----Original Message-----
From: flashnewbie-bounceschattyfig.figleaf.com
[mailto:flashnewbie-bounceschattyfig.figleaf.com] On
Behalf Of Kerry
Thompson
Sent: Saturday, July 28, 2007 9:37 PM
To: 'Flashnewbie Mailing List'
Subject: [Flashnewbie] Navigating with OOP


I'm a little stumped. I'm getting some odd behavior, and I'm
not sure why.

I have this code in the first frame of my main timeline:

stop();

var DreamWeaverRoot = this;
var NextPgBtn:Navigator =
Navitagor(DreamWeaverRoot.attachMovie("NextButtonSymbol
", "Navigator",
DreamWeaverRoot.getNextHighestDepth()));
NextPgBtn.init(652, 546, DreamWeaverRoot);

I have a movie clip in the library named
"NextButton_mc". It's just a simple
clip with "up" and "over" labels, and a
stop(); action on the first frame of
each section.

I have an init() function in my Navigator class, but it is
never being
called, and the movie clip is left in the upper left corner.
Any idea why?

Here is the class:

class Navigator extends MovieClip
{
	private static var pages:Array = [1, 2, 3, 4, 5, 6];
	private var currentPage:Number;
	private var clipRoot_mc:MovieClip;
	
	public function init (x:Number, y:Number,
movieRoot:MovieClip):Void
	{
		currentPage = pages[0];
		this._x = x;
		this._y = y;
		clipRoot_mc = movieRoot;
	}
	
	function onRelease ()
	{
		if (currentPage < pages.length)
		{
			currentPage ++;
			clipRoot_mc.gotoAndStop ("page" +
pages[currentPage]);
		}
	}
	
	function onRollOver()
	{
		this.gotoAndStop ("Over");
	}
	
		function onRollOut()
	{
		this.gotoAndStop ("Up");
	}
}

BTW, the button responds to the RollOver and RollOut
events.

Cordially,

Kerry Thompson


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

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

_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

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

RE: Navigating with OOP
country flaguser name
United States
2007-07-28 17:17:11
Andreas Weber wrote:
 
> Try
> 
> var NextPgBtn:Navigator =
DreamWeaverRoot.attachMovie("NextButtonSymbol",
> "Navigator",
DreamWeaverRoot.getNextHighestDepth());

Logical, but I've tried that already. No go. It just doesn't
execute the
init() in the movie clip subclass.

I suspect it has to do with importing. I'm importing
Navigator; do I need to
import another package to subclass movie clips?

Cordially,

Kerry Thompson


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

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

RE: Navigating with OOP
country flaguser name
United States
2007-07-28 17:30:50
Andreas Weber wrote:
 
> Try
> 
> var NextPgBtn:Navigator =
DreamWeaverRoot.attachMovie("NextButtonSymbol",
> "Navigator",
DreamWeaverRoot.getNextHighestDepth());

Oh, wait, I see what you did. I was looking at the
getNextHighestDepth(),
and missed the fact that you had removed the cast to
Navigator.

I made the change, and it DOES work now. Thanks, Andreas!

Cordially,

Kerry Thompson


_______________________________________________
Flashnewbiechattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashnewb
ie

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

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )