Jump to content


Photo

Help with PHP in Flash


  • Please log in to reply
1 reply to this topic

#1 pagie

pagie
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 25 May 2006 - 07:59 AM

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"); };
};

#2 gerkintrigg

gerkintrigg
  • Members
  • PipPipPip
  • Magician
  • 828 posts
  • LocationBristol, UK
  • Age:37

Posted 25 May 2006 - 01:54 PM

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!!
Neil Trigger - http://www.ghostlypublishing.co.uk - Ghostly Publishing - Children's Fantasy Books




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users