Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 05-08-2004, 10:06 AM   #1
_marabout_
member
 
Join Date: Apr 2003
Location: France
Posts: 77
Default escaping ASCII characters >127 in FlashVars with php urlencode ?

HI,

I want to pass some variables generated by a php script to my flash file.

Theses variables are required as soon as the flash file launches, so I was thinking of passing them using the FlashVars parameter in the EMBED and OBJECT tags. The php script would write the parameters and urlencode their values.

I encounter this problem : this is a French website so the values could have some characters with ASCII values superior to 127 (such as "é"). Colin Moock tells that such characters should be coded in the format %xx%xx (when the Systeme.useCodepage is true).

But : php's urlencode encodes such values in the format %xx, which causes a wrong character to display in Flash.

So, I am considering instead to retrieve the values using loadvars and a php script that delivers the parameters needed, but I'd prefer to avoid it : I would have to pass with flashvars an identifyer that would be then passed from flash to the php script so this one knows what set of parameters it has to deliver.

May be there is another solution : to set the format of the HTML page to unicode. I am not sure, but may be it could avoir to escape the problematic characters in the FlashVars parameter?

Or, there is a way to keep the page in its coding, and manage to encode the characters with php in FlashVars ?

I am kind of lost to decide what to do... if anyone has precious information about this, thanks for posting !

_marabout_
_marabout_ is offline   Reply With Quote
Old 05-08-2004, 10:34 AM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Howdy...

This is what I think...

You are trying to transfer some characters via HTML and PHP is being translated into HTML as well, so you do not need to do any conversion by using urlencode() function... (I could be wrong though...)

Here is the PHP code...
PHP Code:
<?php
    $str 
"êáâãäåæçèéêëìêîïðñòóôõö÷øùúûüýþÿ";
?>
<HTML>
<HEAD>
<TITLE>testHighChars</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0" RIGHTMARGIN="0" BOTTOMMARGIN="0" SCROLL="NO">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<TABLE WIDTH="100%" HEIGHT="100%" BORDER="0">
  <TR align="center" valign="middle">
    <TD>
      <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
              codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
              WIDTH=350
              HEIGHT=100>
              <PARAM NAME=FlashVars VALUE="chars=<?=$str?>">
              <PARAM NAME=movie VALUE="testHighChars.swf">
              <PARAM NAME=quality VALUE=high>
              <PARAM NAME=bgcolor VALUE=#FFFFFF>
              <EMBED src="testHighChars.swf"
                     FlashVars="chars=<?=$str?>"
                     quality=high
                     bgcolor=#FFFFFF
                     WIDTH=350
                     HEIGHT=100
                     TYPE="application/x-shockwave-flash"
                     PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
              </EMBED>
      </OBJECT>
    </TD>
  </TR>
</TABLE>
</BODY>
</HTML>
and the AS is just this line to display the given FlashVars variable...
PHP Code:
this.chars_txt.text _level0.chars
Attached Files
File Type: zip testHighChars.zip (20.2 KB, 333 views)
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 05-08-2004, 10:51 AM   #3
_marabout_
member
 
Join Date: Apr 2003
Location: France
Posts: 77
Default

Well I agree with you, it seems that it works without escaping these chars...

On the other side, Colin Moock says in Chapter 2 of "AS for Flash MX Def Guide" that variables passed via FlashVars should be url encoded, accordingly to the rules explained in the loadVars class of the book.

I though that he had good reasons to say so and concluded that not escaping may work under precise circumstances, but might fail in some others...

Pretty uncomfortable conclusion... What do you think ?
_marabout_ is offline   Reply With Quote
Old 05-08-2004, 10:59 AM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Well... The only problem is that if I add

$str = urlencode($str);

right below where I defined $str, I get nothing in the sample...

Can you tell me the page number so that I can look up my ASDG???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 05-08-2004, 11:06 AM   #5
_marabout_
member
 
Join Date: Apr 2003
Location: France
Posts: 77
Default

I have the French edition, so I am not sure the page number will help.

It's 2/3 pages before the end of chapter 2, the paragraph might name "Loading external variables".
_marabout_ is offline   Reply With Quote
Old 05-08-2004, 03:43 PM   #6
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Hm... I cannot find it... Are we talking about ASDG I???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 05-09-2004, 03:42 AM   #7
_marabout_
member
 
Join Date: Apr 2003
Location: France
Posts: 77
Default

About Moock's "ActionScript for Flash MX : the Definitive Guide, 2nd Edition" (in French)
_marabout_ is offline   Reply With Quote
Old 05-09-2004, 11:08 AM   #8
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

That's what I have but I do not really see the part that goes with FlashVars in chapter 2...
(I've got to tell you that I never really read chapter 2 though... I just skipped that part when I first read the book... )
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 05-09-2004, 11:26 AM   #9
_marabout_
member
 
Join Date: Apr 2003
Location: France
Posts: 77
Default

You'd have impressed me if you had read the book from the very beginning until the last appendix...

I searched O'Reilly's website, there is actually a paragraph named "Loading external variables" at the end of chapter 2. At least it appears on the table of content on the website : http://www.oreilly.com/catalog/actscript2/toc.html
_marabout_ is offline   Reply With Quote
Old 05-09-2004, 11:44 AM   #10
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Ah... Now, I get it..
I got the first edition which has no mention of that part... Buaaaaa~~~~~
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Reply


Thread Tools
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

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

Forum Jump


All times are GMT. The time now is 02:28 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.