Skip to main content
July 2, 2011
Answered

Having Problems making my actionscript 3 work.

  • July 2, 2011
  • 2 replies
  • 1023 views

this is what i had before.

WHY CANT I COPY THE ACTION SCRIPT FROM FLASH AND PASTE IT IN THIS FORUM. I Have 15 buttons and i want to add another. Do i simply copy the button 1 and then paste as button 16 changing where is says button 1? and change from houseoffun to my new url which is: http://sub1.mg.discreetgaming.com/flash/2millionbcv2_en/free.jsp

It gives me errors

stop();

button1.addEventListener(MouseEvent.CLICK, houseoffun);

function houseoffun(e:MouseEvent):void{ var houseoffunLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/houseoffun.jsp"); navigateToURL(houseoffunLink, "_blank"); }

This topic has been closed for replies.
Correct answer Ned Murphy

You can't name things starting with numbers.  Rename your 2millionbc function to something that doesn't start with a number.   The same goes for that variable a couple lines later.

2 replies

July 2, 2011

stop();

button1.addEventListener(MouseEvent.CLICK, houseoffun);

function houseoffun(e:MouseEvent):void{
  var houseoffunLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/houseoffun.jsp");
  navigateToURL(houseoffunLink, "_blank");
  }

button2.addEventListener(MouseEvent.CLICK, slotfather);

function slotfather(e:MouseEvent):void{
  var slotfatherLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/slotfather.jsp");
  navigateToURL(slotfatherLink, "_blank");
  }

button3.addEventListener(MouseEvent.CLICK, rockstar);

function rockstar(e:MouseEvent):void{
  var rockstarLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/rockstar.jsp");
  navigateToURL(rockstarLink, "_blank");
  }

button4.addEventListener(MouseEvent.CLICK, threewishes);

function threewishes(e:MouseEvent):void{
  var threewishesLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/threewishes.jsp");
  navigateToURL(threewishesLink, "_blank");
  }

button5.addEventListener(MouseEvent.CLICK, mrvegas);

function mrvegas(e:MouseEvent):void{
  var mrvegasLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/mrvegas.jsp");
  navigateToURL(mrvegasLink, "_blank");
  }

button6.addEventListener(MouseEvent.CLICK, heist);

function heist(e:MouseEvent):void{
  var heistLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/heist.jsp");
  navigateToURL(heistLink, "_blank");
  }

button7.addEventListener(MouseEvent.CLICK, glamlife);

function glamlife(e:MouseEvent):void{
  var glamlifeLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/glamlife.jsp");
  navigateToURL(glamlifeLink, "_blank");
  }

button8.addEventListener(MouseEvent.CLICK, madscientist);

function madscientist(e:MouseEvent):void{
  var madscientistLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/madscientist.jsp");
  navigateToURL(madscientistLink, "_blank");
  }

button9.addEventListener(MouseEvent.CLICK, onceuponatime);

function onceuponatime(e:MouseEvent):void{
  var onceuponatimeLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/onceuponatime.jsp");
  navigateToURL(onceuponatimeLink, "_blank");
  }

button10.addEventListener(MouseEvent.CLICK, enchanted);

function enchanted(e:MouseEvent):void{
  var enchantedLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/enchanted.jsp");
  navigateToURL(enchantedLink, "_blank");
  }

button11.addEventListener(MouseEvent.CLICK, treasureroom);

function treasureroom(e:MouseEvent):void{
  var treasureroomLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/treasureroom.jsp");
  navigateToURL(treasureroomLink, "_blank");
  }

button12.addEventListener(MouseEvent.CLICK, aztectreasure3);

function aztectreasure3(e:MouseEvent):void{
  var aztectreasure3Link:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/aztectreasure3.jsp");
  navigateToURL(aztectreasure3Link, "_blank");
  }

button13.addEventListener(MouseEvent.CLICK, barbarycoast);

function barbarycoast(e:MouseEvent):void{
  var barbarycoastLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/barbarycoast.jsp");
  navigateToURL(barbarycoastLink, "_blank");
  }

button14.addEventListener(MouseEvent.CLICK, gladiator);

function gladiator(e:MouseEvent):void{
  var gladiatorLink:URLRequest = new URLRequest("http://gb.betsoftgaming.com/free/it/gladiator.jsp");
  navigateToURL(gladiatorLink, "_blank");
  }

button15.addEventListener(MouseEvent.CLICK, golddiggers);

function golddiggers(e:MouseEvent):void{
  var golddiggersLink:URLRequest = new URLRequest("http://mg.betsoftgaming.com/flash/golddiggers_en/free.jsp");
  navigateToURL(golddiggersLink, "_blank");
  }

button16.addEventListener(MouseEvent.CLICK, 2millionbc);

function 2millionbc(e:MouseEvent):void{
  var 2millionbcLink:URLRequest = new URLRequest("http://sub1.mg.discreetgaming.com/flash/2millionbcv2_en/free.jsp");
  navigateToURL(2millionbcLink, "_blank");
}

ERRORS ARE:

Symbol 'content', Layer 'Actions', Frame 1, Line 108 1084: Syntax error: expecting rightparen before millionbc.

Symbol 'content', Layer 'Actions', Frame 1, Line 110 1084: Syntax error: expecting identifier before 2.

  Symbol 'content', Layer 'Actions', Frame 1, Line 111 1084: Syntax error: expecting identifier before 2.

  Symbol 'content', Layer 'Actions', Frame 1, Line 112 1084: Syntax error: expecting rightparen before millionbcLink.
 

Ned Murphy
Ned MurphyCorrect answer
Legend
July 2, 2011

You can't name things starting with numbers.  Rename your 2millionbc function to something that doesn't start with a number.   The same goes for that variable a couple lines later.

July 3, 2011

ok, but does it have to be the button name? the button name is button 16 and i put that in the place of 2millionbc and it still does not work.

brent

Ned Murphy
Legend
July 2, 2011

The code is okay for what it is.  Copy and paste the errors you are getting.