-
Javascript Into Flash
I'm trying to get the enemydown league position javascript to work in flash.
<script language="JavaScript" src="http://www.enemydown.co.uk/ed_clanrank.php?ladder=5&clan=6081"></script>
I've got no idea , can someone help me please. x
-
anyone?
-
-
Re: Javascript Into Flash
Originally posted by RossMcColl
I'm trying to get the enemydown league position javascript to work in flash.
<script language="JavaScript" src="http://www.enemydown.co.uk/ed_clanrank.php?ladder=5&clan=6081"></script>
I've got no idea , can someone help me please. x
Would you mind supplying the script so we can see what you are trying to run?
-
<script language="JavaScript" src="http://www.enemydown.co.uk/ed_clanrank.php?ladder=5&clan=6081"></script>
Thats the script.
-
-
well it says javascript, and when you run it in html is provides a picture depending on where abouts the clan is in the league it changes the picture.
All I want is for it to work in flash.
-
Lifetime Friend of Site Staff
The link is to a PHP script that generates some DHTML (the "javascript") that rewrites the part of your page it's pulled into. This approach will not work in Flash. However, it doesn't mean that you can't make it work, it will just take a bit more effort.
What you have to do is load the result of calling the PHP script into Flash. Parse the "javascript" and pull out the image reference and then use loadMovie to pull that into a movieclip (assuming it's a JPEG file).
Here's some code you can use to get the results of the script into a Flash variable where you can start playing with it. Just drop this code into frame 1 of the main timeline of a blank movie and run it to see the results.
Code:
LoadVars.prototype.decode = function(str)
{
this.$pureloadvars = str;
var path = this.$pureloadvars;
path = path.split("&");
for (var i = 0; i<path.length; i++) {
path[i] = path[i].split("=");
this[path[i][0]] = {};
this[path[i][0]] = path[i][1];
}
};
obj = new LoadVars();
obj.onLoad = function() { trace(obj.$pureloadvars); }
obj.load("http://www.enemydown.co.uk/ed_clanrank.php?ladder=5&clan=6081");
-
Very nice North. My hat goes off to you.
-
Lifetime Friend of Site Staff
I can't take full credit, the code was shamelessly stolen from John Dowdell and I've found many other uses for it since. I've used it to load and parse HTML pages, load the results of CGI scripts (as I showed above), read local files and just about anything you can specify in a URL. It's a very handly little beast
-
If I ever see you, I'll buy you a big muffin.
Cheers
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
|