|
-
(Advanced) - Passing variables directly to .swf file
Hey FlashKit community,
I have written a C++ .exe file that takes one parameter like this (if you were to run on the cmd line):
It takes the parameter and makes this call to my .swf file:
Code:
C:\>myflash.swf?param1=http://whatever/something.mp3
However it notifies me that
Code:
The system cannot find the file myflash.swf?param1=http://whatever/something.mp3
myflash.swf does indeed exist in C:\, but Windows seems to think I'm making a call to an .mp3 file called myflash.swf?param1=http://whatever/something.mp3.
Now, in a web page, you can easily pass a variable to Flash using the QueryString, and nothing thinks that the file is really an mp3 file.
Why does Windows not recognize the QueryString when web browsers seem to be ok with them (even on my local machine)? Is there a known way around it or another way to pass the variable?
Thanks all,
Snib
http://www.snibworks.com
-
Senior Member
This is basically because Windows does not use URI syntax to manage the local file system; query strings in that syntax are meaningless to Windows as it doesn't recognise characters such as ? to mean the start of an arguments list.
As you've already pointed out, you pass an argument to an exe with a space and then the argument; it would be the same for flash, if flash could receive arguments from the command line.
I'm not a Windows developer (or user), but I think if you need to pass variables to Flash like this, seeing as you can write C++, then you should probably look at writing those variables out to a text file which flash then reads in.
Try asking in the standalone forum, probably people have already build something that does this.
Sam

-
Snib,
I'm looking for exactly the samething. I want to know if there's a way to send value to swf file during execution. I wrote a program in java that would simulate html, but no luck at all. Same error message.
If you find solution(s) or work around please let me know. My email is [email protected].
Best regards,
Hiren
-
Sam,
You are a genius. I will try doing this.
Snib
http://www.snibworks.com
-
Sam,
Thanks a lot for the idea, I got it working seemlessly.
Hiren,
If you want the C++ app I ended up writing let me know (PM).
Snib
http://www.snibworks.com
-
Hi Snib,
Yes I would like the C++ app!
You may send it as attachment to [email protected]
Best Regards,
Hiren
-
Senior Member
Snib,
What was your solution? Did you use c++ to create a text file that flash could read or did you figure out a way or syntax that could be used in the cmd line?
I am in the same boat, only I can't write to a text file
I am trying to pass variables between Flash and Installshield. Has anyone done this before?
_t
-
I wrote to a text file with C++ and then had Flash read the file with LoadVars(). It's the best way I could find.
If you like I can post the C++ code for you here, or I can send you the .exe that launches it if you can give me the
1. name of the file to launch
2. name of the text file to write to
3. what parameters you want to write to the text file and what to call them
Let me know,
Snib
http://www.snibworks.com
-
Senior Member
Thanks, but I'm afraid that won't help. I was hoping to pass variables to an exe or bat file, which I'm finding out is not possible.
I'm working with Installshield, which can get variables from the Command Line, but I have no clue how to get them there from Flash.
I guess I'm going to have to write a bat file for each install. I was hoping to be able to pass a variable to the bat file instead of creating one for every install.
Thanks anyway.
_t
-
Hi Snib.
I spend a lot of time to find out how to "Pass variables directly to .swf file in C++" .
So, please you send to me your sample do this.
i try to PM to you but not success. Can you email to [email protected] ?
Thanks so much for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|