Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Outputting Text To Flash

by mt2k (Hermit)
on May 27, 2002 at 23:21 UTC ( #169665=note: print w/replies, xml ) Need Help??

in reply to Outputting Text To Flash

Yep, I should have known that this was a simple problem to solve... Don't ask me why, but I did not try the most obvious flicking thing on the planet: reading the perldocs for HTML::Entities and URI::Escape. Of course, I even had the answer in my post (just a little hidden):

"This is the same format that is used for query strings attached to URLs"

Now, since you are saying "but you should use URI::Escape, of course!" then you are right ;)

So a perl script to do a little work with flash:

#!c:/perl/bin/perl -w use strict; # I am getting into the habit of using this! use URI::Escape; # For escaping special characters # Keys of this hash correspond to flash variable names: my %output = ( 'infobox' => '1+1=2 & 2+2=4 yep!' ); # Send the HTTP header (content-type does not seem to matter) # I have used text/plain since that sounds the best ;) print qq|Content-type: text/plain\n\n|; # Loop through each of the variables in the %output hash # Function - Encode characters and print them to flash for (my ($name,$value) = each %output) { print qq|$name=| . uri_escape($value) . "&"; }

How to execute this from flash (the '0' as the second argument means to load the variables in global scope):

loadVariablesNum ("path/to/", 0);

Replies are listed 'Best First'.
Re: Re: Outputting Text To Flash
by termix (Beadle) on May 28, 2002 at 10:49 UTC

    A very elegant solution no doubt (may be could have used ;).

    Also FlashMX requires (by documentation and experience) that the content type be application/x-www-urlform-encoded. Although it has no problem getting static text files back as text/plain, I think it requires the specialized type when it has tried sending variables through. You never know which of your users have upgraded to the "Flash 6" browser plugin, so you might want to be careful.

    -- termix

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://169665]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2022-09-30 07:27 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (125 votes). Check out past polls.