Nooby question

  • Flashnoob
  • Born
  • Born
  • Flashnoob
  • Posts: 3

Post 3+ Months Ago

So, just started with flash, I did some a very long time ago, but decided to do some now... however, it seems I have forgotten much of it. Tried to make a Guitar Hero quiz to get started but got problems in a just a few minutes... so, what did i do wrong? :oops: :P

Code: [ Select ]
stop();
set ( var1, random(5));
if ( var1 = 1 ) {
    set q1 = "Carry on My Waywards Son is the encore in what tier?";
    set a1 = "The fifth";
    set a2 = "The third";
    set a3 = "The second";
    
}
if else (var1 = 2) {
    set q1 = "Who is ranked number one on Scorehero?";
    set a1 = "Quackadilly";
    set a2 = "ES942";
    set a3 = "SArmstr0ng";
}
if else (var1 = 3) {
    set q1 = "Which band made the song Six?";
    set a1 = "All That Remains";
    set a2 = "Buckethead";
    set a3 = "Lynyrd Skynyrd";
}
if else (var1 = 4) {
    set q1 = "How did the members of the band Lynyrd Skynyrd die?";
    set a1 = "Drugs";
    set a2 = "Plane crash";
    set a3 = "They didn't";
}
if else (var1 = 5) {
    set q1 = "On the first game, which two songs are made by Ozzy?";
    set a1 = "Crazy Train, Bark at the Moon";
    set a2 = "Crazy Train, In Fire";
    set a3 = "Bark at the Moon, In Fire";
}
  1. stop();
  2. set ( var1, random(5));
  3. if ( var1 = 1 ) {
  4.     set q1 = "Carry on My Waywards Son is the encore in what tier?";
  5.     set a1 = "The fifth";
  6.     set a2 = "The third";
  7.     set a3 = "The second";
  8.     
  9. }
  10. if else (var1 = 2) {
  11.     set q1 = "Who is ranked number one on Scorehero?";
  12.     set a1 = "Quackadilly";
  13.     set a2 = "ES942";
  14.     set a3 = "SArmstr0ng";
  15. }
  16. if else (var1 = 3) {
  17.     set q1 = "Which band made the song Six?";
  18.     set a1 = "All That Remains";
  19.     set a2 = "Buckethead";
  20.     set a3 = "Lynyrd Skynyrd";
  21. }
  22. if else (var1 = 4) {
  23.     set q1 = "How did the members of the band Lynyrd Skynyrd die?";
  24.     set a1 = "Drugs";
  25.     set a2 = "Plane crash";
  26.     set a3 = "They didn't";
  27. }
  28. if else (var1 = 5) {
  29.     set q1 = "On the first game, which two songs are made by Ozzy?";
  30.     set a1 = "Crazy Train, Bark at the Moon";
  31.     set a2 = "Crazy Train, In Fire";
  32.     set a3 = "Bark at the Moon, In Fire";
  33. }


Thats the coding in the first keyframe, a1, a2 and a3 are the answering boxes and q1 is the question box.

NOTE: I'm no way done, just started.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Flashnoob
  • Born
  • Born
  • Flashnoob
  • Posts: 3

Post 3+ Months Ago

Figured :P Nvm, delete this topic if you want.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

In the off-note, have you contemplated a switch/case to handle this? A bit simpler & easier on the processor that way...
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

yea, switch case will do better than a multitude of if ... else.
Even better would do a xml file.
  • Flashnoob
  • Born
  • Born
  • Flashnoob
  • Posts: 3

Post 3+ Months Ago

UPSGuy wrote:
In the off-note, have you contemplated a switch/case to handle this? A bit simpler & easier on the processor that way...


Huh? :P :oops:

But it's not really supposed to be on a website or something, just wanted to train my actionscript a bit.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Well then you should especially be learning best-practice work while you relearn the subject! Do a look up for switch/case in actionscript and you'll see what we mean. I can copy a function's code 100 times into my actionscript, but the (most times) proper thing to do is make it a function and call it 100 times...just because it's possible doesn't make it the best way. Clean code and knowledgable methods has gotten me many a job over others who stick to the crude way of doing things.
  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

UPS, why do you lie to a flashnoob?
he doesn't need to learn anything ... if so, why are we here? aren't we payed to answer all the questions? :P
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Yep. Although, BWM is starting to use the same lost in the mail excuse over again... :)

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 19 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.