Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Button link not working

0 views
Skip to first unread message

painlessbart225

unread,
Aug 17, 2007, 9:08:48 AM8/17/07
to
I have a Dynamic page that is a parts list in a MySQL database that I show on a
page using PHP in Dreamweaver.
The page uses a repeat region to list the parts depending on what nav link is
clicked and what I want to do is add a flash button to the repeated region that
when clicked will take you to a larger view. I have all of this setup and
working fine except for the flash button.

For instance when the page is loaded you may see 10 parts listed and the
button will show up 10 times also, one button next to each part listed. I am
currently using a simple image as a link to the larger view and it works fine.
The link looks like this.

largeview.php?SearchField=<?php echo $row_Recordset1['Part']; ?>

My problem is that flash doesn't read the php in this code: "<?php echo
$row_Recordset1['Part']; ?>". I need flash to read the php code so it knows
what part number to show.

Is there any other code that can be used to have Flash read the php code?

I hope I explained this properly and any help would be greatly appreciated!

I am new to flash so please spell it out for me.

Thanks


clbeech

unread,
Aug 17, 2007, 9:31:22 AM8/17/07
to
To get variables from php you'll need to use the LoadVars class, but how to do
so depends on the methods that you are using throughout your system(s). you
may also be able to use a FlashVar and pass the variable to the button, but
again it dependes on how you're creating these elements. Did you make these
buttons or are they 'stock'? Are they independent, or all part of one Flash
file? You will need to add other code(s) either in Flash AS, Java, HTML or all
of them depending on how your files function.

Post some links to your files, so that folks here can understand the problem
and help you solve it.

painlessbart225

unread,
Aug 17, 2007, 9:42:13 AM8/17/07
to
Here is the link to the page I am working on:
http://www.painlessperformance.com/webcatalog/catview.php

Clicking on any link in the nav bar to the left loads different parts using
PHP.
The entire page is PHP. The "More Info" image is currently just an image with
a link attached that shows a larger view of the part and more info. I just want
to use flash to create a button that will follow the link to the larger view so
nothing will load in the flash button it will only be a link.

Gorka Ludlow

unread,
Aug 17, 2007, 10:09:31 AM8/17/07
to
Flash reads text from dynamically generated pages (php) exactly the same as it
reads a text file. What you need to do is learn how to read text files in flash
(with loadvars) and then wirte the php files in the flash readable format.

Cheers,
Gorka
www.AquiGorka.com

clbeech

unread,
Aug 17, 2007, 10:39:55 AM8/17/07
to
You should be able to pass the value of the link string using a FlashVar. In
your embedding script, set the 'value' parameter to read something like this:

value="moreinfoBtn.swf?link=largeview.php?SearchField=<?php echo
$row_Recordset1['Part']; ?>"

this should set the variable 'link' to the URL. Then in your button code in
Flash, retreive the dynamic value within the getURL method for the button:

moreInfoBtn.onRelease = function() {
getURL(link, "_self");
}

if you still would like Flash to display the part number, use String.subString
to get the last 5 characters from the value of 'link' and assign them to a
textField.

dzedward

unread,
Aug 17, 2007, 11:02:27 AM8/17/07
to
why are you taking this complicated process just to make a button in flash?
what is wrong with what you have now? why don't you create a nice looking
button in Photoshop or Illustrator? make Up/Over/Down states and all them
appropriately withing the PHP file..

painlessbart225

unread,
Aug 17, 2007, 12:07:27 PM8/17/07
to
clbeech I appreciate your help but I really need you to draw me a picture.

you say to put this code in the ebedding script:
value="moreinfoBtn.swf?link=largeview.php?SearchField=<?php echo
$row_Recordset1['Part']; ?>"
but I don't know if you mean in flash somewhere or in my php code somewhere?

and when I use this code in flash I just get errors.

moreInfoBtn.onRelease = function() {
getURL(link, "_self");
}

Where exactly does this code need to be placed and are you writing it exactly
like it should be or is there something else I need to be adding to it?

Thanks for your patience


dzedward

unread,
Aug 17, 2007, 12:14:04 PM8/17/07
to
clbeech is referring to FlashVars... did you follow his link? you add that to
the embed script.. <param name="FlashVars"
value="moreinfoBtn.swf?link=largeview.php?SearchField=<?php echo
$row_Recordset1['Part']; ?>" />

clbeech

unread,
Aug 17, 2007, 12:25:17 PM8/17/07
to
If your page is being generated with php, you must have a function somewhere
that is writting the HTML embedding code for the moreInfoBtn 'image'.
depending on how this is being generated, you need to find a place to add to
the value parameter within the controling function, in either way we have
defined (dzedward's is probably more accurate).

@dz: do you think that the '?' will confuse Flash, act as a delimiter and
break the string into additional variables? not as associatives, though.

dzedward

unread,
Aug 17, 2007, 12:34:38 PM8/17/07
to
<<@dz: do you think that the '?' will confuse Flash, act as a delimiter and break the <<string into additional variables? not as associatives, though.

No, as long as it's in the embed code..

painlessbart225

unread,
Aug 17, 2007, 3:25:16 PM8/17/07
to
Ok, I have this in the php code where the image of the flash is:
<param name="FlashVars"
value="moreinfoBtn.swf?link=largeview.php?SearchField=<?php echo
$row_Recordset1['Part']; ?>" />

Now, what should I do with the button?

dzedward

unread,
Aug 17, 2007, 3:28:56 PM8/17/07
to
do you have an embed script in your php file? paste the embed code on here using the attach code option

clbeech

unread,
Aug 17, 2007, 3:37:38 PM8/17/07
to
are you're refering to 'where' to put it? (same directory, just the swf file,
make sure the title is the same)

if you're refering to the button code, we'd looked into it earlier:

dzedward

unread,
Aug 17, 2007, 3:41:15 PM8/17/07
to
your embed script should look like this[attached], but you need to changed the
size of the SWF if you use this example.. also, I URL encoded the ? just in
case... and your onRelease script is right under it[attached].

//-------------------Embed script---------------------

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#
version=8,0,0,0" width="550" height="400" id="moreinfoBtn" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie"
value="moreinfoBtn.swf?link=largeview.php%3FSearchField=<%3Fphp echo
$row_Recordset1['Part'];%3F>" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="moreinfoBtn.swf?link=largeview.php%3FSearchField=<%3Fphp echo
$row_Recordset1['Part'];%3F>" quality="high" bgcolor="#ffffff" width="550"
height="400" name="urlvariables" align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

//------------------------onRelease for button-------------------------

moreInfoBtn.onRelease = function() {
getURL(_level0.link, "_self");
};

painlessbart225

unread,
Aug 17, 2007, 3:43:20 PM8/17/07
to
I get errors when I insert this in the action script section on the button.

moreInfoBtn.onRelease = function() {
getURL(link, "_self");
}

<?php
$colname_Recordset1 = "1";
if (isset($HTTP_GET_VARS['SearchField'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ?
$HTTP_GET_VARS['SearchField'] : addslashes($HTTP_GET_VARS['SearchField']);
}
mysql_select_db($database_Painless, $Painless);
$query_Recordset1 = sprintf("SELECT * FROM AllParts WHERE Catagory = '%s'",
$colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $Painless) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_Recordset2 = $colname_Recordset1;
if (isset($HTTP_GET_VARS['Recordset1.Catagory'])) {
$colname_Recordset2 = (get_magic_quotes_gpc()) ?
$HTTP_GET_VARS['Recordset1.Catagory'] :
addslashes($HTTP_GET_VARS['Recordset1.Catagory']);
}
mysql_select_db($database_Painless, $Painless);
$query_Recordset2 = sprintf("SELECT * FROM tblWebCatalog WHERE CatID = %s",
$colname_Recordset2);
$Recordset2 = mysql_query($query_Recordset2, $Painless) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>

<?php
if(file_exists("include/supertop.php"))
include("include/supertop.php");?>
<head>
<script src="../Scripts/AC_RunActiveContent.js"
type="text/javascript"></script>

</head>
<body topmargin="0">

<div align="left">

<font size="6"><strong><?php echo $row_Recordset2['webcatagory'];
?></strong></font>
</div>
<p align="center">
<script type="text/javascript">
AC_FL_RunContent(
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#
version=7,0,19,0','width','625','height','80','src','/webcatalog/images/shopatro
nbuybanner','quality','high','pluginspage','http://www.macromedia.com/go/getflas
hplayer','movie','/webcatalog/images/shopatronbuybanner' ); //end AC code
</script><noscript><object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve
rsion=7,0,19,0" width="625" height="80">
<param name="movie" value="/webcatalog/images/shopatronbuybanner.swf">


<param name="quality" value="high">

<embed src="/webcatalog/images/shopatronbuybanner.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="625" height="80"></embed>
</object></noscript>
</p>
<p align="center"><font size="6"><img src="../images/largeviewimage.jpg"
width="500" height="29" id="Image1"></p>
<p><font size="4"><?php echo $row_Recordset2['WebCatPageHdr']; ?></font> </p>
<hr>
<?php do { ?>
<table width="657" border="0" cellpadding="0" cellspacing="0"
bgcolor="#000000">
<tr>
<td width="185"></td>
<td width="482"></td>
</tr>
<tr>
<td><strong><font size="4">Part# <?php echo $row_Recordset1['Part'];
?></font></strong></td>
<td></a></td>
</tr>
<tr>
<td colspan="2"> <strong><font size="4"><?php echo
$row_Recordset1['Description']; ?></font></strong></td>
</tr>
<tr>
<td align="left" valign="top"><div align="left">
<script type="text/javascript">
AC_FL_RunContent(
'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#
version=7,0,19,0','width','50','height','25','src','/webcatalog/moreInfoBtn','qu
ality','high','pluginspage','http://www.macromedia.com/go/getflashplayer','movie
','/webcatalog/moreInfoBtn' ); //end AC code
</script><noscript><object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve
rsion=7,0,19,0" width="50" height="25">
<param name="movie" value="/webcatalog/moreInfoBtn.swf">


<param name="quality" value="high">

<param name="FlashVars"
value="moreinfoBtn.swf?link=largeview.php?SearchField=<?php echo
$row_Recordset1['Part']; ?>" />

<embed src="/webcatalog/moreInfoBtn.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="50" height="25"></embed>
</object></noscript></td>
<td><a href="largeview.php?SearchField=<?php echo $row_Recordset1['Part'];
?>"><img src="thumbs/<?php echo $row_Recordset1['image']; ?>" alt="Part # <?php
echo $row_Recordset1['Part']; ?>" border="0"></a></td>
</tr>
<tr>
<td colspan="2" align="left" valign="top"><strong><?php echo
$row_Recordset1['Information']; ?></strong></td>
</tr>
<tr>
<td height="52" colspan="2"><hr></td>
</tr>
</table>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<p>&nbsp;</p>
</body>
<?php
if(file_exists("include/superbottom.php"))
include("include/superbottom.php");
?>

<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>

dzedward

unread,
Aug 17, 2007, 3:48:19 PM8/17/07
to
you php should be this...

</head>
<body topmargin="0">

classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#

version=8,0,0,0" width="50" height="25" id="moreinfoBtn" align="middle">


<param name="allowScriptAccess" value="sameDomain" />
<param name="movie"
value="moreinfoBtn.swf?link=largeview.php%3FSearchField=<%3Fphp echo
$row_Recordset1['Part'];%3F>" />

<param name="quality" value="high" />


<embed src="moreinfoBtn.swf?link=largeview.php%3FSearchField=<%3Fphp echo

$row_Recordset1['Part'];%3F>" quality="high" width="50" height="25"
name="moreinfoBtn" align="middle" allowScriptAccess="sameDomain"

type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />

painlessbart225

unread,
Aug 17, 2007, 4:10:24 PM8/17/07
to

painlessbart225

unread,
Aug 17, 2007, 4:25:45 PM8/17/07
to
Is that right? Still nothing is working. I have copied the php code and
replaced my code with yours.

I have the button code set to the on release just as you said.

I must be doing something wrong or maybe I'm just not understanding you.

but now the link goes no where.

dzedward

unread,
Aug 17, 2007, 4:16:54 PM8/17/07
to
and...

dzedward

unread,
Aug 17, 2007, 4:25:01 PM8/17/07
to
you need to cut that code, and past it on a frame.. it should say "Actions-Frame". and make sure your button has instance name of moreInfoBtn

dzedward

unread,
Aug 17, 2007, 4:29:05 PM8/17/07
to
did you put that code on a Frame? does your button have instance name of
moreInfoBtn... take screen shots of where you code is(like the last one), and
take screen shot after you click your button on stage once.. post links to them

dzedward

unread,
Aug 17, 2007, 5:03:13 PM8/17/07
to

painlessbart225

unread,
Aug 17, 2007, 5:13:16 PM8/17/07
to
Ok, did that and now I have a link but here is where it is going

http://www.painlessperformance.com/webcatalog/undefined

dzedward

unread,
Aug 17, 2007, 5:22:00 PM8/17/07
to
both those links go to 404 not found pages... so you did what was described in my image link? and you can click the button but it does nothing, or what happens exactly?

painlessbart225

unread,
Aug 17, 2007, 5:19:20 PM8/17/07
to

painlessbart225

unread,
Aug 17, 2007, 5:31:56 PM8/17/07
to

dzedward

unread,
Aug 17, 2007, 5:38:12 PM8/17/07
to
so $row_Recordset1['Part']; is an html page? it should be something like
blahblah.html
Replace PHP with attached:

</head>
<body topmargin="0">

<param name="movie" value="moreinfoBtn.swf" />
<param name="FlashVars" value="link=<?php echo
(urlencode($row_Recordset1['Part']));?>" />


<param name="quality" value="high" />

<param name="bgcolor" value="#ffffff" />

<embed src="moreinfoBtn.swf" FlashVars="link=<?php echo
(urlencode($row_Recordset1['Part']));?>" quality="high" bgcolor="#ffffff"

0 new messages