homepage Welcome to WebmasterWorld Guest from 54.234.228.64
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
Forum Library, Charter, Moderator: open

Flash and Shockwave Forum

    
CS3 AS2.0 Dynamic Image issue
Modern Merlin




msg:3703911
 9:16 pm on Jul 21, 2008 (gmt 0)

Ok here is where I am at. I have an action script that pulls data from a database by way of PHP. When it comes back to flash, I use parseInt() to be able to read the numbers with Flash.

This all works fine and the number displays fine in flash, however I got to thinking. Instead of displaying the number I would like to display an image. Meaning if x = 1 then display the image otherwise if x = 0 then display nothing.

What I want to know is, is this posiible and if so... How do I do it?

Thanks!

MM

 

eelixduppy




msg:3703988
 10:44 pm on Jul 21, 2008 (gmt 0)

You need to write conditionals:

if(x == 1) {
// show image
} else {
// do not show image
}

See the docs: [adobe.com...]

Modern Merlin




msg:3704013
 11:21 pm on Jul 21, 2008 (gmt 0)

Im sorry I probably should have been more clear in my question. 5hrs of sleep in the last three days will do that to ya! ;)

I know to put it in a if else statement, but do I put that in Flash? And if so can I have the image display in a dynamic text box or what do I have to put there to have the image appear in a certain spot on the stage?

MM

Modern Merlin




msg:3704174
 6:17 am on Jul 22, 2008 (gmt 0)

Would something like this work?

<?php
//--------------------MYSQL DETAILS ---------------------------------------//
//mysql details
require_once("config.php");
//Passing the lookup variable from flash
$user = $_POST['user'];
$stash = $_POST['tStash'];
$SQL = "SELECT * FROM mobster WHERE account_id ='".$user."'";
$rs = mysql_query($SQL,$conn);
//Putting the results in an array
$result = mysql_fetch_array($rs);
//------------------ Assign Variables ---------------------------------//
$chr_name = $result['chr_name'];
$tMail2 = $result['new_mail'];
$tAttack2 = $result['new_attack'];
$tInvite2 = $result['new_invite'];
$tTransfer2 = $result['new_transfer'];
$tFammsg2 = $result['new_fammsg'];
$tBusmsg2 = $result['new_busmsg'];
$tTurns = $result['cturns'];
$tNet = $result['networth'];
$tStashTurns = $result['stashTurns'];
if ($tMail2 == 1){
$tMail = "http://www.mydomain.com/images/dicered.gif";
} else {
$tMail = '';
}
if ($tAttack2 == 1){
$tAttack= "http://www.mydomain.com/images/dicered.gif";
} else {
$tAttack = '';
}
if ($tInvite2 == 1){
$tInvite = "http://www.mydomain.com/images/dicered.gif";
} else {
$tInvite = '';
}
if ($tTransfer2 == 1){
$tTransfer = "http://www.mydomain.com/images/dicered.gif";
} else {
$tTransfer = '';
}
if ($tFammsg2 == 1){
$tFammsg = "http://www.mydomain.com/images/dicered.gif";
} else {
$tFammsg = '';
}
if ($tBusmsg2 = =1){
$tBusmsg = "http://www.mydomain.com/images/dicered.gif";
} else {
$tBusmsg = '';
}
echo "&var1=$tMail&var2=$tAttack&var3=$tInvite&var4=$tTransfer&var5=$tFammsg&var6=$tBusmsg&var7=$tTurns&var8=$tNet&var9=$tStashTurns&varName=$chr_name&";
?>

The if statements are to load the content path of a loader in Flash.

Thanks!

MM

EDIT: Actually I got it working... I changed the == 1 to > 0 and not the images are coming up!

[edited by: Modern_Merlin at 6:24 am (utc) on July 22, 2008]

eelixduppy




msg:3704538
 3:12 pm on Jul 22, 2008 (gmt 0)

Nice :) Glad you got it working.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Flash and Shockwave
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved