From the look of it, the complaint is about "mynav" not existing on the
parent clip - nsprite. Because mynav is not a property of Sprite, you
may have to use the DisplayObjectContainer methods to access mynav -
again, I was working in AS2 "style", so directly accessing may not have
worked for the AS3 version:
function onRolloverHandler(e:MouseEvent):void {
var nsprite:Sprite = e.currentTarget as Sprite;
if(nsprite) {
var mynav:TextField = nsprite.getChildByName("mynav") as TextField;
if(mynav) {
TextField(nsprite.mynav).bgcolor = 0x97f9ec;
} else {
trace("can't find 'mynav' child of nsprite);
}
}
}
John Singleton wrote:
From: Glen Pike <[email protected]>
To: Flash Coders List <[email protected]>
Sent: Tue, March 9, 2010 1:26:14 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online
Sorry, my typo / error.
You need to change bgcolor to backgroundColor in the event handler
functions (bgcolor is not a property of TextField), e.g.
TextField(nsprite.mynav).backgroundColor = 0x...
No, I caught that and made the appropriate substitution. My vars are actually
different than what I'm posting. That's not the problem. Please take a look at
what I sent earlier.
Thanks,
John
John Singleton wrote:
From: Glen Pike <[email protected]>
To: Flash Coders List <[email protected]>
Sent: Tue, March 9, 2010 12:22:03 PM
Subject: Re: [Flashcoders] Re: swf doesn't work the same online
Hi,
You need to make your nav function return the sprite it creates, so change the
"signature" to:
function nav(nname:String, nurl:String, myX:int, bgcolor:uint):Sprite
and return "nsprite" at the bottom.
Thanks. That worked. Now I see that in your original instructions. Oops. I was doing this piecemeal and testing as I went along, sorry.
Now I get this error:
Error: 1119: Access to possibly undefined property mynav...
I figured that might have something to do with not having defined bgcolor, so I
added the following in the class' function definition:
var bgcolor:uint = new uint();
However, that then threw a new error:
Error #1151: A conflict exists with definition bgcolor
This, I assume, because of the following line:
function nav(nname:String, nurl:String, myx:int, bgcolor:uint):Sprite
That's the only place where that variable shows up and it of course is used in
that function. I guess I'm confused as to how to work with those variables
outside of the nav function, as you have me call them here:
function onRolloverHandler(e:MouseEvent):void {
var nsprite:Sprite = e.currentTarget as Sprite;
if(nsprite && nsprite.mynav) {
TextField(nsprite.mynav).bgcolor = 0x97f9ec;
}
}
which, of course, is where I'm getting in trouble.
Thanks,
John
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders