Jump to content

Help with PHP in Flash


pagie

Recommended Posts

Hello, I was hoping someone would be able to help me with a script which me and my friend have written. I cannot for some reason get it to work correctly. I am very new to PHP and this is my first time on the forums so if there is something blatantly obvious, please just laugh on the inside... [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]

I have a flash file which I want to display a new image depending on which page I am on.

Anyways, here is the script... any help would be much appreciated!


/*
this line will return the path and filename from document root
ie [a href=\"http://www.tom.com/test/example.php\" target=\"_blank\"]http://www.tom.com/test/example.php[/a] the result will be /test/example.php
*/

$url = $PHP_SELF;

/*
I want to break down the $url to the filename only - so I am going to tokenize on the / character initially
ie above will provide 3 tokens stored in a variable titled $url_pholder
1 - ""
2 - "test"
3 - example.php
*/

$url_pholder = explode("/", $url);

/*
The filename is always the last token therefore only want that one
last token is (length - 1) element of the $url_pholder array - therefore work out length then extraxt it
*/

$pholder_length = count ($url_pholder) - 1;
$url = $url_pholder[$pholder_length]; // example.php

if ($url == "index.php")

{ echo
if(this.mcImage == Number(this.mcImage))
{loadMovieNum("banner_1.jpg",this.mcImage); }
else { this.mcImage.loadMovie("banner_1.jpg"); };
}

elseif ($url == "2.php")

{ echo
if(this.mcImage == Number(this.mcImage))
{ loadMovieNum("banner_2.jpg",this.mcImage); }
else { this.mcImage.loadMovie("banner_2.jpg"); };
}

elseif

{ echo
if(this.mcImage == Number(this.mcImage))
{ loadMovieNum("order_wines.jpg",this.mcImage); }
else { this.mcImage.loadMovie("order_wines.jpg"); };
};
Link to comment
Share on other sites

In a vain attempt to make your life easier while, at the same time, adding at least one reply to this otherwise barron post, I'll have a go at it. (what was the question again?)...

Okay I think the problem is your "echo" statement... I think it should be a rpint statement.

I could be wrong, but every time I do this sort of thing, that's how I do it...

I might look for your help on this problem at some point in the future because I'm going to be trying to make a chat room from PHP, Flash and MySQL in September!! (lord help us!).

Try that...
Any more problems, try also:
[a href=\"http://www.sephiroth.it/tutorials/flashPHP/loadVars/\" target=\"_blank\"]This good intro to loading variables from PHP into Flash[/a]

good luck!!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.