A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] Reading values set when loading swf

Hybrid View

  1. #1
    Member
    Join Date
    Mar 2004
    Posts
    135

    resolved [RESOLVED] Reading values set when loading swf

    Hi all, I've got a unique situation on my hands.

    I have some server side code that takes a url visited and returns a swf file. This swf file needs to know the address that it is being loaded from so that it can take certain actions.

    So if I have:
    - example.com/ex1/movie.swf
    - example.com/ex2/movie.swf

    I need the video to be able to know if it is being loaded from ex1 or ex2.

    Is this possible without JavaScript being present in the code loading the swf file? If not what alternatives would be available to me?

    Thank you.

    **As a note I am working in Flex 3 so all related libraries are available.
    Last edited by ChiefDesigns; 08-13-2008 at 11:48 AM.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I am not sure I completely understand your situation. If you need to pass the url to the flash movie you can use php for example and add the url for the video as a var ?myVar=ex1/movie.swf

    Then you can pass this as a Flashvars to the flash movie.

    As I said i am not sure what exactly you are trying to do. You may want to explain further.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Member
    Join Date
    Mar 2004
    Posts
    135
    cancerinform,

    Let me give some background information on what I am doing:
    I have many clients who need to load a swf file from my server in to their sites. I have no way of enforcing how the clients load my swf files in to their pages so using FlashVars isn't really an option. The swf files loaded by all of these different clients is the same swf but I need the swf to know the location that it is being loaded from on my server.

    How I am loading the swfs:
    I am using mod_rewrite with Apache to run a php file with specific urls. This php file is passed elements of the request url - example.com/var/movie.swf where var is the string that is unique to each client. The php code then sets the mime-type of the request and outputs the data from the swf file residing on my server.

    What I need:
    I either need the swf file to know what location it is being requested from (example.com/client83/movie.swf) or I need some way to inject a variable in to the swf's binary when it is being loaded by the php code.

    Thanks again for your help.

  4. #4
    Member
    Join Date
    Mar 2004
    Posts
    135

    Smile Solved

    I used Application.application.loaderInfo.url to retrieve the url where the swf is residing.

  5. #5
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    loaderInfo.url should tell you the address the swf was requested at.

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