ctess
09-25-2008, 07:56 PM
Here is what I am trying to do.
I am trying to resize a flash file dynamically based on the information I grab from the object itself. My problem is not getting it to work, I have it working actually, but by itself.
My problem occurs when I have the objects loaded using AJAX. I can't post the entire code because of NDA agreements, but this one stumped me so I had to see if anyone had a better outlook on this than I do.
ok first this is how I am "injecting" the code into the page:
function getSimulator(content) {
var pContent, pHeader, pSimFile, pRevise;
pHeader = content.match(/<h2>(.*)<\/h2>/);
pRevise = content.match(/<p class="revised">(.*)<\/p>/);
pSimFile = content.match(/<SIMOBJECT>(.*)<\/SIMOBJECT>/);
pSimFile[0] = getDir() + "simulator/";
pSimURL = "http://" + getServerName() + getDir() + "/simulator/product.swf?feature="+pSimFile[1].replace(".swf","");
pContent = "<DIV id='debugDIV' style='display:none;'></DIV>" +
"<table border='0' cellpadding='0' cellspacing='0' style='margin-left:20px;'>"+
"<tr>"+
"<td id='featureHeading'>"+
"Simulator - " + pHeader[1] +
"</td>" +
"</tr>" +
"<tr>" +
"<td id='simwrapper' name='simwrapper'>"+
"<OBJECT CLASSID='CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000' ID='simulator' name='simObject' width='100%' height='100%'>"+
"<PARAM NAME='MOVIE' VALUE='" + pSimURL + "'>"+
"<PARAM NAME='BASE' VALUE='" + pSimFile[0] + "'>"+
"<PARAM NAME='QUALITY' VALUE='best'>"+
"<PARAM NAME='BGCOLOR' VALUE='#FFFFFF'>"+
"<PARAM NAME='MENU' VALUE='false'>"+
"</OBJECT>"+
"</td>"+
"</tr>"+
"<tr>"+
"<td class='revised'>"+
pRevise[1] +
"</td>" +
"</tr>" +
"</table>";
return pContent;
}
That basically takes the file ajax is pulling, detects the SIMOBJECT tag's and if they are there it then basically rewrites the content with the code for the flash embed.
Then after the code has been "written" to the page itself I call this function to grab the width and resize the flash embed.
function resizeFlash() {
var simulator = document.getElementById('simObject');
simulator.width = simulator.TGetProperty('/',8).value + "px";
}
The error I get is object required. However if I use an alert() before I specify the width it shows that the object does exist. So I am not sure what to do about this.
Like I said before. I can get this to work alone in it's own html file but when I introduce AJAX into the mix it screws it up.
Any thoughts or suggestions?
I am trying to resize a flash file dynamically based on the information I grab from the object itself. My problem is not getting it to work, I have it working actually, but by itself.
My problem occurs when I have the objects loaded using AJAX. I can't post the entire code because of NDA agreements, but this one stumped me so I had to see if anyone had a better outlook on this than I do.
ok first this is how I am "injecting" the code into the page:
function getSimulator(content) {
var pContent, pHeader, pSimFile, pRevise;
pHeader = content.match(/<h2>(.*)<\/h2>/);
pRevise = content.match(/<p class="revised">(.*)<\/p>/);
pSimFile = content.match(/<SIMOBJECT>(.*)<\/SIMOBJECT>/);
pSimFile[0] = getDir() + "simulator/";
pSimURL = "http://" + getServerName() + getDir() + "/simulator/product.swf?feature="+pSimFile[1].replace(".swf","");
pContent = "<DIV id='debugDIV' style='display:none;'></DIV>" +
"<table border='0' cellpadding='0' cellspacing='0' style='margin-left:20px;'>"+
"<tr>"+
"<td id='featureHeading'>"+
"Simulator - " + pHeader[1] +
"</td>" +
"</tr>" +
"<tr>" +
"<td id='simwrapper' name='simwrapper'>"+
"<OBJECT CLASSID='CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000' ID='simulator' name='simObject' width='100%' height='100%'>"+
"<PARAM NAME='MOVIE' VALUE='" + pSimURL + "'>"+
"<PARAM NAME='BASE' VALUE='" + pSimFile[0] + "'>"+
"<PARAM NAME='QUALITY' VALUE='best'>"+
"<PARAM NAME='BGCOLOR' VALUE='#FFFFFF'>"+
"<PARAM NAME='MENU' VALUE='false'>"+
"</OBJECT>"+
"</td>"+
"</tr>"+
"<tr>"+
"<td class='revised'>"+
pRevise[1] +
"</td>" +
"</tr>" +
"</table>";
return pContent;
}
That basically takes the file ajax is pulling, detects the SIMOBJECT tag's and if they are there it then basically rewrites the content with the code for the flash embed.
Then after the code has been "written" to the page itself I call this function to grab the width and resize the flash embed.
function resizeFlash() {
var simulator = document.getElementById('simObject');
simulator.width = simulator.TGetProperty('/',8).value + "px";
}
The error I get is object required. However if I use an alert() before I specify the width it shows that the object does exist. So I am not sure what to do about this.
Like I said before. I can get this to work alone in it's own html file but when I introduce AJAX into the mix it screws it up.
Any thoughts or suggestions?