A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: encode variable behind url

  1. #1
    I have the following code that work fine,

    Code:
    on (release) {
    	cardno = 1234;
    	random2 = Math.ceil(Math.random()*1000000);
    	loadVariablesNum("view.php?reload="+random2, 0, "POST");
    	gotoAndPlay(3);
    }
    but what if i wanan encode the "cardno" var behind an url, somthing like
    http://www.demo.com/view.htm?cardno=1234

    it doesn't work anymore. Any idea?

    chup

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    I am not sure whether I understand you...
    Server scripts (php, cgi, asp) understand variables in the url unless you decide otherwise, and swf files understand them.
    Html files do not understand vars, unless you add some javascript that picks them up

    Musicman

  3. #3
    hi,

    so if i save my view.htm into view.php, will it work?
    in my case, view.php will be just a simple html file without any php script but save in php format. the php script that that will load infromation from the database will be call from the swf itself. Is this the correct flow?

    chup

  4. #4
    World Kit Vote Holder Abelius's Avatar
    Join Date
    Feb 2002
    Location
    US
    Posts
    963
    Could it be that cardno is handled as a number instead of as a string?

    Mybe using the cardno = cardno.toString(); would work...

  5. #5
    I think i will explain my problem in more detail..

    i have 3 file now
    card.swf ---> swf file with script to call viewcard.php
    card.php ---> the html file that contain card.swf but save in php format
    viewcard.php ---> the php script that does all the job.

    it work okie if this following script is in the 1st frame of card.swf

    Code:
    viewID = 8230; //dummy id number for testing
    cardno = viewID ;
    cardno = cardno.toString();
    random2 = Math.ceil(Math.random()*1000000);
    // Loads the Variables
    loadVariablesNum("viewcard.php?reload="+random2, 0, "POST");
    play();

    but now, i wanna the viewID to be encode behind the card.php, some like
    Code:
    www.demo.com/card.php?viewID=8230
    with this following code on the swf only
    Code:
    cardno = viewID ;
    cardno = cardno.toString();
    random2 = Math.ceil(Math.random()*1000000);
    // Loads the Variables
    loadVariablesNum("viewcard.php?reload="+random2, 0, "POST");
    play();
    but it not working at all..
    where is the mistake?

    chup

  6. #6
    Registered User
    Join Date
    Feb 2001
    Posts
    13,039
    Hi,

    do I understand you right: you want to pass the number to card.php, and card.php should pass it on to card.swf, so that card.swf knows how to call the viewcard.php ?

    Inside card.php, add these changes
    <object...> <param name=movie value="card.swf?cardID=<?=$cardID?>"> .... <embed src="card.swf?cardID=<?=$cardID?>" ....>

    Card.swf will then have the cardID variable defined without further action.
    Using both POST and explicit vars is somewhat useless; if you add vars to the query string anyway, you should perhaps
    loadvariablesNum('viewcard.php?reload='+random2+'& cardID='+cardID, 0)

    Musicman

  7. #7
    yeah, thanks!

    problem sloved..

    chup
    [Edited by chup on 05-30-2002 at 07:10 AM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center