Flash
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Iron Speed
Go Back   Tutorialized Forums2D GraphicsFlash

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 4th, 2008, 03:25 AM
Banjo Banjo is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Banjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 25 m 22 sec
Reputation Power: 0
Random Frame when answer is correct

As topic says i want my game to go to a random frame when i am inserting the right answer in the input text.

After a couple of hours searching for the correct Action script i came up with this:
Code:
on (release, keyPress "<Enter>") {
	gotoAndStop(random(6));
}


But as you see it doesn't matter if it is the correct answer or not it just goes to a random frame when i am pressing the button.

I tried adding this:
Code:
if (answer = "a");

(My input text Var is answer)


Without any success, and i am now sitting here like a big Question mark, i would really appreciate it if you could help me with this one.

Thanks
//Banjo

Last edited by Banjo : May 4th, 2008 at 03:56 AM.

Reply With Quote
  #2  
Old May 7th, 2008, 03:49 AM
thunder thunder is offline
Moderator
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 379 thunder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 13 h 36 m 49 sec
Reputation Power: 2
Firstly. Does your random code work?? Cause I've been looking for that for a while.

But try this, or have you already?
Code:
on (release, keyPress "<Enter>") {
if (_root.answer = "a");
gotoAndStop(random(6));
trace ("Your answer is correct.");
} else if (_root.answer != "a") {
trace ("Your answer is incorrect.");
}
}
__________________
Ask me for help in the following areas:
Flash - Should be able to help
HTML/Dreamweaver/Web Design - Should be able to help.
CSS - Can help in some areas

Also working on:
JavaScript
PHP
C++
DHTML

Reply With Quote
  #3  
Old May 7th, 2008, 04:55 AM
Banjo Banjo is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Banjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 25 m 22 sec
Reputation Power: 0
Code:
on (release, keyPress "<Enter>") {
	gotoAndStop(random(6));
}


this one works it will take you a random frame 1-6, but as i said it didn't work when i tried binding it with my input text.

If that is what you mean

But thanks i will try that one as soon as i am home .


Thanks
/Banjo

Reply With Quote
  #4  
Old May 7th, 2008, 08:51 AM
Banjo Banjo is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 7 Banjo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 25 m 22 sec
Reputation Power: 0
Code:
**Error** Scene=Scene 1, layer=Layer 1, frame=6:Line 4: 'else' encountered without matching 'if'
     } else if (_root.answer != "a") {

Total ActionScript Errors: 1 	 Reported Errors: 1


:\\


Code:
on (release, keyPress "<Enter>") {
if (_root.answer = "a");
gotoAndStop(random(6));
}


Tried this one and it worked except that if you press the button with no text in the input box it just writes down an A and goes to another frame.

I will try to figure out a solution

Thanks again
//banjo

Reply With Quote
  #5  
Old May 7th, 2008, 10:16 AM
EagleVision's Avatar
EagleVision EagleVision is offline
Moderator
Click here for more information. Click here for more information
 
Join Date: Feb 2008
Location: Florida
Posts: 255 EagleVision User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 15 h 37 m 27 sec
Reputation Power: 1
Send a message via MSN to EagleVision
I might sound dumb, but where is this code going in?

Reply With Quote
  #6  
Old May 7th, 2008, 07:15 PM
thunder thunder is offline
Moderator
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2006
Posts: 379 thunder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 13 h 36 m 49 sec
Reputation Power: 2
Sorry... I didn't test that. It doesn't like the if in the else if () {. Just change it to else () {

Sorry again.

Reply With Quote
Reply

Viewing: Tutorialized Forums2D GraphicsFlash > Random Frame when answer is correct


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway