A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: passing variables with query string

  1. #1
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82

    passing variables with query string

    Does anybody have any experience passing vaiables with the query string ?

    I'm trying to pass and integer ( 0 to 2 ) to be able to go to a certain picture slide depending on what picture they clicked.

    Below is the code I inserted, Is there something special we have to do in koolmoves to make it work ?

    any help would be greatly appreciated.
    thanks


    <param name="movie" value="tstarksmp.swf?slideNum=slideNumber" />
    <embed src="tstarksmp.swf?slideNum=slideNumber" width=224 height=324
    bgcolor="#ffffff" quality="high" loop="true"
    type="application/x-shockwave-flash"
    pluginspace="http://www.macromedia.com/go/getflashplayer" />


    <a
    href="javascript:NewWindow=window.open('tstarksss. html?slideNumber=0','newWi
    na','width=510,height=510,left=10,top=10,
    toolbar=No,location=No,scrollbars=No,status=No,res izable=No,fullscreen=No');
    NewWindow.focus();
    void(0);">

    <a
    href="javascript:NewWindow=window.open('tstarksss. html?slideNumber=1','newWi
    na','width=510,height=510,left=10,top=10,
    toolbar=No,location=No,scrollbars=No,status=No,res izable=No,fullscreen=No');
    NewWindow.focus();
    void(0);">

    <a
    href="javascript:NewWindow=window.open('tstarksss. html?slideNumber=2','newWi
    na','width=510,height=510,left=10,top=10,
    toolbar=No,location=No,scrollbars=No,status=No,res izable=No,fullscreen=No');
    NewWindow.focus();
    void(0);">

  2. #2
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    ok, not getting any responses !

    Let me try again, and get some input.

    I got an html page that has small pictures that are links to the big pictures. I want to use the slideshow component, then use the gotoSlide() function. I want the slideshow to go to the same slide as the one clicked. I thought the
    query string approached was appropriate, but I can't get it to work.

    any suggestions or solutions ?

    thanks in advance.

  3. #3
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Passing variables works fine but you are passing them to "tstarksss.html" .
    Is there any code in this html file to process the variable and pass is on to the swf file ?

  4. #4
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    Hi W.
    thanks for the reply.

    I don't think there's code to handle that ! I'm confused, but think I have it straight now - but it still doesn't work. So, any help would be appreciated.


    ok, here what I got :

    here is the code that call the swf, it is a slideshow that I exported as a swf and html page.

    <a href="javascript:NewWindow=window.open('tstarksss. html','newWin','width=510,height=510,left=10,top=1 0,
    toolbar=No,location=No,scrollbars=No,status=No,res izable=No,fullscreen=No'); NewWindow.focus();
    void(0);">


    now , here is the html page :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <!-- saved from url=(0013)about:internet -->
    <meta name="GENERATOR" content="Koolmoves">
    <script src="AC_RunActiveContent.js" type="text/javascript"></script>
    </HEAD>
    <BODY BGCOLOR="#ffffff">
    <CENTER>
    <script type="text/javascript">AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','loop','true','bgcolo r','#ffffff','width','500','height','500','src','t starksss','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','tstarksss');
    </script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" id=tstarksss width=500 height=500 codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
    <param name="movie" value="tstarksss.swf?slideNum=0" />
    <param name="quality" value="high" />
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="bgcolor" value="#ffffff" />
    <embed src="tstarksss.swf?slideNum=0" width=500 height=500 bgcolor="#ffffff" quality="high" loop="true"
    type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer" />
    </object></noscript>
    </CENTER>
    </BODY>
    </HTML>


    the tutorial I am trying to use is at : http://www.permadi.com/tutorial/flashQueryString/ it says " You can append a query string following the Flash movie filename, and Flash will get the variable(s) from the query string for you automatically. The variable(s) will go into the _root or _level0 of the movie. "


    obviously, I missing something ? I will attach my fun file as well.
    Attached Files Attached Files

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    PHP Code:
    <script type="text/javascript">AC_FL_RunContent('codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','loop','true','bgcolor','#ffffff','width','500','height','500','src','tstarksss','quality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','tstarksss.swf?slideNum=0');
    </
    script><noscript><object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" id=tstarksss width=500 height=500 codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">
    <
    param name="movie" value="tstarksss.swf?slideNum=0" />
    <
    param name="quality" value="high" />
    <
    param name="play" value="true" />
    <
    param name="loop" value="true" />
    <
    param name="bgcolor" value="#ffffff" />
    <
    embed src="tstarksss.swf?slideNum=0" width=500 height=500 bgcolor="#ffffff" quality="high" loop="true"
    type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer" />
    </
    object></noscript
    Changed the first line a little, there were some extra spaces and added the variable and the .swf extension to the movie name just as it is in the Object tag and the embed tag.

    Also what Wilburt I think is asking you is how is slideNum getting the value 0?

    You cannot pass a variable to HTML in the URL so unless this page is dynamically created via PHP or ASP or something like that slideNum has to be hand set tot he proper value.
    Last edited by blanius; 06-24-2008 at 10:31 PM.

  6. #6
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    Brett, Wilbert,

    about where slideNum was getting set, that was my mistake in the posting, I thought that as long as it was in the url, flash could get it.

    So, the only change I saw was ".swf?slideNum=0" added to the end of the <script> tag, when I did this the movie doesn't work - remove the code, and it works again. ( what I mean by doesn't work - I clicked the tstartksss0.html and it comes up blank - no navigation controls or pictures)

    There is another post with the same problem by trntula. He says that you can
    change the AC_FL_RunContent and it works, but I didn't quite understand it, so I wanted to find out the real skinny. I did do some research on this before I posted - it seemed like every one was different with no straight, concise and clear solution.

    I am not married to the query string approach, I have limited php experience,
    but I think I could write something there, albeit it seems a little extreme to go to all of that work just to pass a number. So if you got any ideas of how to
    be able to click a html link and get a slidenumber passed in, let me know.

    thanks,
    John

  7. #7
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    The solution in that other thread is the same one I posted, I just changed the line, thought you could look at the differences and see what I added.

    As for passing a variable you just need PHP which is available on most servers.

    when you send a variable in the URL like ?slideNum=2 in the PHP you can access it like this

    <?php
    $slideNum=$_GET['slideNum'];
    ?>

    then where you want to use the number just put
    <?php echo $slideNum;?>

  8. #8
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    Bret and Wilbert,

    ok, thanks for trying to help me, I'm not sure I really understood what I was doing, but I finally figured it all out. It was so simple I really feel dumb.It was as simple as just dropping in the php code <? php echo $slideNum; ?> for the value parameter in the script, param name, and embed tags in the html file. Then saving as a .php file and ofcourse running it on a php enabled server.

    When I said that "with my limited knowledge of php" thing, I was thinking more along the lines of writing a file and reading it- good ol' brute strength programming, but there was a much easier way.

    I made examples of passing statically thru the File->Export Settings... and then modifying it to handle query strings. Would the forum be interested in me posting them ? examples for when someone else ask this question ?

  9. #9
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184
    Quote Originally Posted by Putz
    Would the forum be interested in me posting them ? examples for when someone else ask this question ?
    I'm interested in seeing your solution Putz.

    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

  10. #10
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    Hi Nightcap,

    Here they both are.
    Attached Files Attached Files

  11. #11
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184
    Thanks for posting the files Putz. I downloaded them and I'll have a look at them early next week. This weekend is kinda full with activities.

    Have a good 4th!

    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

  12. #12
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    nightcap,
    No problem, you'll see how easy it is !

  13. #13
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184
    Putz, I just tried both the examples and they work like a charm. Everything is well documented and the files are a great help for everybody who wants to get familiar with this subject.

    Thanks for sharing!

    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

  14. #14
    Member
    Join Date
    Apr 2007
    Location
    Plano Texas USA
    Posts
    82
    Cool, glad I could help ! wracked my brains out ( at least what I have) trying to figure that out, then realized that it wasn't that hard. We need more examples like that, it would make the koolmoves learning curve much faster.

  15. #15
    Ubi bene, ibi patria Nightcap's Avatar
    Join Date
    Jun 2007
    Location
    GA, USA
    Posts
    184
    Yeah, I know what you mean. Luckily there's always the KoolExchange, but still it can take some effort from the ol' brain cells to figure it all out.

    Everybody thinks of changing humanity,
    Nobody thinks of changing himself.

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