try changing your <head> code to this:
<head>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("Spotlight_en_gb", "8");
function CountryCode(){
var tempObj2 = swfobject.getObjectById('Spotlight_en_gb');
if(tempObj2)
{
tempObj2.SetVariable('ccode', 'KSA');
}
}
swfobject.addDomLoadEvent(CountryCode);
</script>
</head>
using swfobject.addDomLoadEvent is a cleaner way to invoke your function and
frees you from placing JS at the bottom of your <body> element.
- philip
On Mon, Apr 6, 2009 at 12:03 AM, Fahad Bhatti <[email protected]>wrote:
> I have tried updating the code but its giving me error:
>
> Error: swfobject.getObjectById("Spotlight_en_gb") is null
> Source File: vartest.html<http://www.showtimearabia.com/test/Var/vartest.html>
> Line: 17
> But working correctly in IE
>
> Fahad.
>
>
>
> On Mon, Apr 6, 2009 at 10:47 AM, Fahad Bhatti <[email protected]>wrote:
>
>> Thanks Kyle,
>>
>> Do you mean i should modify my JS script from:
>>
>> function CountryCode(){
>> var tempObj = document.getElementById('Spotlight_en_gb');
>> if(tempObj)
>> {
>> tempObj.SetVariable('ccode', countryCode);
>> }
>> }
>>
>> TO:
>>
>> function CountryCode(){
>> var tempObj = swfobject.getObjectById('Spotlight_en_gb');
>> if(tempObj)
>> {
>> tempObj.SetVariable('ccode', countryCode);
>> }
>> }
>>
>>
>> Regards
>> F.
>>
>> On Sun, Apr 5, 2009 at 6:10 PM, Getify Solutions, Inc. <
>> [email protected]> wrote:
>>
>>>
>>> For static publishing, use swfobject.getObjectById() -- that'll resolve
>>> which one you need to grab for scripting purposes.
>>>
>>> Also, I'm pretty sure you can (and should) use the same ID for both, as
>>> swfobject (and the conditionals) take care of making sure only one is in
>>> the
>>> DOM eventually.
>>>
>>> --Kyle
>>>
>>>
>>>
>>>
>>> --------------------------------------------------
>>> From: "FahadB" <[email protected]>
>>> Sent: Sunday, April 05, 2009 4:00 AM
>>> To: "SWFObject" <[email protected]>
>>> Subject: Passing a Var to the flash file using Object id doesnt work in
>>> FF
>>>
>>> >
>>> > Hi there
>>> >
>>> > I am using swfobject for calling up my flash files plus the alternate
>>> > content, I have one dynamic textbox in flash which acquires the
>>> > javascript generated value in it by using document.getelementbyid.
>>> >
>>> > Even if its IE or !IE i have to pass that variable to my flash, but as
>>> > we are using 2 Object tags with the conditions on IE and !IE, I cannot
>>> > pass the same id to both object tags, due to which its works well only
>>> > in IE but not getting the variable value in !IE example FF.
>>> >
>>> > Can anyone help on how to pass on the same variable value to !IE
>>> > versions, code below:
>>> >
>>> > <script type="text/javascript" src="swfobject.js"></script>
>>> >
>>> > <script type="text/javascript">
>>> > swfobject.registerObject("Spotlight_en_gb", "8");
>>> >
>>> > function CountryCode(){
>>> > var tempObj2 = document.getElementById('Spotlight_en_gb');
>>> > if(tempObj2)
>>> > {
>>> > tempObj2.SetVariable('ccode', 'KSA');
>>> > }
>>> >
>>> > }
>>> > </script>
>>> > / head
>>> >
>>> > body:
>>> >
>>> > <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
>>> > width="550" height="400" id="Spotlight_en_gb" wmode="transparent">
>>> > <param name="movie" value="Vartest.swf?"/>
>>> > <param name="wmode" value="transparent" />
>>> > <param name="menu" value="false" />
>>> > <!--[if !IE]>-->
>>> > <object type="application/x-shockwave-flash" data="Vartest.swf?"
>>> > width="770" height="276" wmode="transparent">
>>> >
>>> > <!--<![endif]-->
>>> > <!--Non Flash Content-->
>>> > Alternate Flash Content
>>> > <!--Non Flash Content End-->
>>> > <!--[if !IE]>-->
>>> > </object>
>>> > <!--<![endif]-->
>>> > </object>
>>> > <script type="text/javascript">CountryCode();</script>
>>> > / body
>>> >
>>> >
>>> > Please help....
>>> > >
>>> >
>>>
>>> >>>
>>>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---