Jump to content

SWF file keeps expanding to table cell height and width(I think)-URGENT help nee


Recommended Posts

Hi there, I'm creating a voting system (which needs to be ready by this Thursday) with PHP, XML and Flash. The only thing that is puzzling me now is the fact that when I load in flash files into the PHP table (using XML in between), for some reason they are being blown up a lot bigger than they should be. The swfs are exported at 100W and 30H but are being expanded possibly to the dimensions of the table cell they are being put in - I have no idea how to sort this out!! You can see the site here http://www.st-augustines.worcs.sch.uk/departments/music/

 

Any ideas why this could be happening? I've tried a few different settings in Flash when outputting the swf but nothing seems to help!

 

Here's my PHP:

 

<?

//
// SET VARIABLES
//

// name of XML file which contains your image data
$xml_file = "poll.xml";

// path to header file
$header_file = "poll_header.inc";

// path to footer file
$footer_file = "poll_footer.inc";

// set to 0 for testing
$one_vote_per_user = 0;

// import request variables
import_request_variables("gp", "request_");

// make "request_pid" an integer
settype($request_pid, "integer");


//
// DEFINE FUNCTIONS
//

// isClosed(): check whether poll is closed
// if poll is closed, return closing date
// if poll is not closed, return false
function isClosed($pid) {
// get "polls" object into this scope
global $polls;

// get closing date and split into three parts (year, month, and day)
$closing_date = explode("-", $polls->poll[$pid]->closingdate);

// if today's date is after closing date, then return closing date
if (mktime() > mktime(0, 0, 0, $closing_date[1], $closing_date[2], $closing_date[0])) {
$closing_date = date("l, F j, Y", mktime(0, 0, 0, $closing_date[1], $closing_date[2], $closing_date[0]));
return $closing_date;
}

// if today's date is on or before closing date, return false
else {
return false;
}
}


// printVotingForm(): print voting form
function printVotingForm($pid) {
// get these variables in this scope
global $polls, $header_file, $footer_file;

// include header file
include($header_file);

// print poll title and form
echo "<h3 style=\"text-align: center\">" . $polls->poll[$pid]['title'] . "</h3>\n";
echo "<form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"post\">\n";
echo "<fieldset>\n";
echo "<input type=\"hidden\" name=\"pid\" value=\"$pid\" />\n";
echo "<ul style=\"list-style-type: none\">\n";
echo "<table class=\"dark\" width=\"100%\" cellspacing=\"2\" cellpadding=\"5\">\n";

// count number of answers
$no_answers = count($polls->poll[$pid]->answers->answer);
$flash = $polls->poll[$pid]->answers->answer[$i]->flash;

// print each answer as a checkbox
if ($polls->poll[$pid]->multipleanswers == "yes") {
for ($i = 0; $i < 5; $i++) {
echo "<li><input type=\"checkbox\" name=\"vote[]\" value=\"" . $polls->poll[$pid]->answers->answer[$i]->name . "\" />" . $polls->poll[$pid]->answers->answer[$i]->name .
(isset($polls->poll[$pid]->answers->answer[$i]->image)?
'<img src="' . $polls->poll[$pid]->answers->answer[$i]->image . '">'
:'').
"</li>\n";
}
}

// print each answer as a radio button
else {
for ($i = 0; $i < 3; $i++) {
echo "<td>";
$name = $polls->poll[$pid]->answers->answer[$i]->name;
$song = $polls->poll[$pid]->answers->answer[$i]->song;
$image = $polls->poll[$pid]->answers->answer[$i]->image;
$flash = $polls->poll[$pid]->answers->answer[$i]->flash;

$embedImg = "<br /><img src='{$image}' />";

$embedFlash = "<br /><object width='100' height='30'>
<param name='movie' value='{$flash}'>
<embed src='{$flash}'></embed>
</object>";

echo "<input type='radio' name='vote' value='{$name}' /><br />" . "<strong>$name;</strong>";
echo "<br />" . $song;
echo !empty($image) ? $embedImg : '';
echo !empty($flash) ? $embedFlash : '';

"\n";
}
} 

and my XML from which the PHP file is looking for swfs from!

 

<?xml version="1.0"?>
<polls>
<poll title="Who do you think should win Pop Icons 2009?">
    <answers>
    <answer>
        <name>Axelle:</name>
        <song>Killing Me Softly</song>
        <tally>0</tally>
        <image>images/1.jpg</image>
        <flash>songs/1.swf</flash>
    </answer>
    <answer>
        <name>Bethanie:</name>
        <song>I Think We're Alone Now</song>        
        <tally>0</tally>
        <image>images/2.jpg</image>
        <flash>songs/2.swf</flash>        

    </answer>
    <answer>
        <name>Ciara:</name>
        <song>Serious</song>        
        <tally>0</tally>
        <image>images/3.jpg</image>
        <flash>songs/3.swf</flash>                
    
    </answer>            
    </answers>    
    <multipleanswers>no</multipleanswers>
    <closingdate>31-01-2009</closingdate>
</poll>
</polls>

If someone could look through it for me that would be fab - if you have any ideas they would be greatly appreciated!!

 

Cheers

Chris

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.