A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: get url and send variable

  1. #1
    Member
    Join Date
    Apr 2003
    Posts
    75

    get url and send variable

    I have a button in my flash movie and this code
    on(click){
    getUrl("redirect.php","_self")
    }

    but I also want to send a variable let's say "submit" to this page
    if my variable will be "0" the script will do something
    if it will be "1" ....

    if I want to send a varaible to a php script I do this way
    newEntry = new LoadVars()
    newEntry.ref = this
    newEntry.submit = "0"
    newEntry.sendAndLoad("redirect.php?, newEntry , "POST");

    but how can I lunch a php page and also send a variable to this page

  2. #2
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    on(release){
    getURL("redirect.php","_blank","POST")
    }

    ...wil send all variables in the current timeline.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  3. #3
    Member
    Join Date
    Apr 2003
    Posts
    75
    I tried but it didnt worked

    this is the php page
    <?php
    $submit = $_POST['submit'];
    if ($submit == '0){
    commands........
    exit;
    ?>

    and flash script
    on(click){
    newEntry = new LoadVars()
    newEntry.ref = this
    newEntry.submit = "0"
    getURL("redirect.php", "_blank" , "POST");
    }

    I have a page with my flash movie and when I press the button I want a
    new page redirect.php to open but also to send this variable to the page

    I dont understand why it didnt work

  4. #4
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Why do you write on(click) ... had no idea there is such a command ( sounds like Swisch or something ).

    In php should be, quotes....

    if ($submit == '0')

    Im not good with php, but from other scripts Ive seen you compare with a single = character.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  5. #5
    Member
    Join Date
    Apr 2003
    Posts
    75
    yes this is corect $submit == '0',I made a mistake only when I wrote on forum in my script it is exactly like this: $submit == '0'

    I use the button component and this is why I use on(click) in flash mx 2004

    this is not the problem I used it in ather scripts and examples that work fine

  6. #6
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    Then Im out of suggestions.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  7. #7
    Member
    Join Date
    Apr 2003
    Posts
    75
    can you give pls an example where you used getURL to send a variable
    to a php page and it worked?

  8. #8
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    I have only used....

    this.loadVariables("write.php","POST");

    ...that sends all variables in the current timeline to the script. ( in my case a script that writes all variables sent, to a textfile ).

    Last in the php script I usually have....

    echo "state=done&";

    .....to tell that Flash the variables are saved.

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  9. #9
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70

    new issue or the same?

    i need to send one variable from my main time line to an email.

    i thought i'd use...

    __________

    "mailto:chriswilshaw@hotmail.com" [_blank ["disporder"]]
    __________

    ...in the get url area as an expression

    and set the send vars to "get"

    "disporder" is the only variable i care to recieve on email. there are 10's of variables in the timeline i dont want.

    do i have to send the variable to a new time line and send the email from that timeline

    seems too much of a work arround - can someone help? please

  10. #10
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You will need a mailscript to send mails from Flash. With the mailto you would only open the users default email program with a option to put in the subject and part of the body.

    Heres a tutorial on sending mails from Flash.

    http://www.flashkit.com/tutorials/Dy...-658/index.php

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  11. #11
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70

    still not there...

    this is a stripped version of my fla if anyone would like to look

    ps it doesnt work, yet...

    can it?
    Attached Files Attached Files

  12. #12
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70
    sorry piano,

    must have replied at same time, i will look at your help, thanks

  13. #13
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70
    repeat

    head, wall, bang,

    until done


    pele, i think i would be fine if i could just cause the users email package to open and put my varable contents into either the subject or body

    ive done someting (in the past but havent got the file) and it allowed you to put something like "&subject" after the email address.

    am i barking up the right tree? or wrong forest altogether?

  14. #14
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    heres an example.

    code:
    someVariable="JOHN";
    getURL("mailto:info@pelepiano.com?subject="+someVa riable+"..is the best!&body=HI!");


    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  15. #15
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70
    you are great, thanks.

    Code:
    on (release) {
        getURL("mailto:chriswilshaw@hotmail.com?subject="+ordernum+"&body=+disporder+", thanks);
    }
    i tried this and got "+disporder+" back in my email (varable name not contents)

    any ideas

  16. #16
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70
    ok i spotted the problem with the " in the wrong place and have a new, not working fla attached
    Attached Files Attached Files

  17. #17
    Member
    Join Date
    Sep 2004
    Location
    uk
    Posts
    70
    just to clear things up, i wasnt accusing your code of not working

    ive sorted it now, the above attachment does work, my server hadnt updated my change when i tested. - i think im ok now!

    thanks!!

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