|
-
AS3 Help?????
K i've been struggling for 2days now.. please anyone help!
this is the script i use,
function initapp():void{
urlbuttonit.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttonp.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttonl.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttoni.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttons.addEventListener(MouseEvent.CLICK, buttonClicked);
}
function buttonClicked(event:Event):void
{
if(event.currentTarget == urlbuttonit)
{
navigateToURL(new URLRequest("mywebsite.com:string=null");
}
if(event.currentTarget == urlbuttonp)
{
navigateToURL(new URLRequest("mywebsite.com:string=null");
}
if(event.currentTarget == urlbuttonl)
{
navigateToURL(new URLRequest("mywebsite.com:string=null");
}
if(event.currentTarget== urlbuttoni)
{
navigateToURL(new URLRequest("mywebsite.com:string=null");
}
if(event.currentTarget == urlbuttons)
{
navigateToURL(new URLRequest("mywebsite.com:string=null");
}
}
And it doesn't work.
it give me a syntax error.. i fixed all the other bugs but the last one remains
i am not big in flash but how the hell can i get this to work?
-
Code:
function initapp():void {
urlbuttonit.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttonp.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttonl.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttoni.addEventListener(MouseEvent.CLICK, buttonClicked);
urlbuttons.addEventListener(MouseEvent.CLICK, buttonClicked);
}
function buttonClicked(event:Event):void {
switch (event.currentTarget) {
case urlbuttonit :
navigateToURL(new URLRequest("mywebsite.com"));
break;
case urlbuttonp :
navigateToURL(new URLRequest("mywebsite.com"));
break;
case urlbuttonl :
navigateToURL(new URLRequest("mywebsite.com"));
break;
case urlbuttoni :
navigateToURL(new URLRequest("mywebsite.com"));
break;
case urlbuttons :
navigateToURL(new URLRequest("mywebsite.com"));
break;
default :
break;
}
}
-
AS3 NOT WORKING ! please help..
i tried this but my when i export the clip it goes super crazy!
it just keeps running in a loop.. my buttons not working
-
Can you post your fla here?
Last edited by dawsonk; 11-08-2010 at 12:06 PM.
-
Flash/Flex Developer
Maybe you can try using the IS conditional. Try this out. If it doesn't work, can you post the error you are getting.
Actionscript Code:
function buttonClicked(event:Event):void { if(event.currentTarget is urlbuttonit) { navigateToURL(new URLRequest("mywebsite.com:string=null"); } if(event.currentTarget is urlbuttonp) { navigateToURL(new URLRequest("mywebsite.com:string=null"); } if(event.currentTarget is urlbuttonl) { navigateToURL(new URLRequest("mywebsite.com:string=null"); } if(event.currentTarget is urlbuttoni) { navigateToURL(new URLRequest("mywebsite.com:string=null"); } if(event.currentTarget is urlbuttons) { navigateToURL(new URLRequest("mywebsite.com:string=null"); } }
Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|