Go Back   kirupaForum > Flash > Flash CS3

Reply
 
Thread Tools Display Modes
Old 11-23-2009, 03:13 AM   #1
hellonemo
Registered User
AS2/AS3 How to send parameter in flash? (for ecard quiz)

Hello,

I tried created simple ecard quiz and not expert in AS, so i need help guys.
basically, the ecard will start with 3 questions.
each question has 3 answers.
so user choses the answer e.g. B, B, C and clicks preview.
it will play the movie clip assigned to B B C in sequence.
then user can click send to sent to friend.

so the URL needs to be able to identify the sequence maybe in parameters.
so that when his friend receives the ecard and clicks on the flash it will play B B C sequence.
then his frind can create his own ecard and maybe A C A etc...

So how i created like that?

Thanks
hellonemo is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 11-23-2009, 03:51 PM   #2
Ziggwies
Registered User
 
Ziggwies's Avatar
Location New Zealand

Posts 104
You could try FlashVars.

http://www.permadi.com/tutorial/flashVars/index.html
http://livedocs.adobe.com/flash/9.0/...=00000668.html

__________________

Ziggwies (WebComic)

Ziggwies is offline   Reply With Quote
Old 11-24-2009, 06:45 AM   #3
Swooter
Swooter - AS/JS/HTML/CSS
 
Swooter's Avatar
You'll need to read the variables with javascript or php for example and write the flash embed code accordingly, containing the variables (flashvars)

Javascript example:

mypage.html
HTML Code:
<html>
  <head>
  </head>
  <body>

    <script type="text/javascript">
      if ( location.href.indexOf("?") != -1 ) {
        var $vars = location.href.split("?")[1];
        var $code = '<div style="display:none;">'; // ie6 fix
        $code += '<object width="550" height="400">';
        $code += '<param name="movie" value="http://myserver.com/myflash.swf" />';
        $code += '<param name="flashvars" value="' + $vars + '" />';
        $code += '<embed width="550" height="400" src="http://myserver.com/myflash.swf" type="application/x-shockwave-flash" flashvars="' + $vars + '" /></object>';
        document.body.innerHTML = $code;
      } else {
        document.body.innerHTML = "Error, no variables specified";
      }
    </script>

  </body>
</html>
And then open it like: http://myserver.com/mypage.html?var1...=lorem%20ipsum

and then in AS2:
ActionScript Code:
trace(_level0.var1);
trace(_level0.var2);

__________________

AS / JS / HTML / CSS / PHP
Swooter is offline   Reply With Quote
Old 12-06-2009, 04:03 AM   #4
hellonemo
Registered User
Big thanks Ziggwies and Swooter
I'll try it first
hellonemo is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:16 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com