Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,423
    Thanks
    271
    Thanked 32 Times in 31 Posts

    null is null or not an object swfobject

    Hi i have done some reading on the net today because i am getting an error on ie. I did find the javascript twice in my code, once in the header and once here, so i removed it from the header. I also changed to src to the full url.

    But i am still getting this and i dont know why. the file is located in the root directory.

    Code:
    Webpage error details
    
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SearchToolbar 1.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; msn OptimizedIE8;ENUS)
    Timestamp: Sat, 30 Jul 2011 16:03:05 UTC
    
    
    Message: 'null' is null or not an object
    Line: 8
    Char: 3894
    Code: 0
    URI: http://www.mysite.com/swfobject.js

    Code:
    <script type='text/javascript' src='$CONST_LINK_ROOT/swfobject.js'></script>
    <script type='text/javascript'>
    var s1 = new SWFObject('player.swf','player','400','300','9');
    s1.addParam('allowfullscreen','true');
    s1.addParam('allowscriptaccess','always');
    s1.addParam('flashvars','file=$CONST_LINK_ROOT/movies/$sql_array->vid_id.flv');
    s1.write('preview');
    </script>
    <embed src='$CONST_LINK_ROOT/flvplayer.swf?file=$CONST_LINK_ROOT/movies/$sql_array->vid_id.flv&autoStart=false' width='175' height='175' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>
    would appreciate any suggestions thanks.


    i was on 1.5 swfobject i did download 2.2 and im guessing all you do is replace the swfobject.js file to upgrade it, but what happened is it gives me this now.

    Code:
    Webpage error details
    
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SearchToolbar 1.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; msn OptimizedIE8;ENUS)
    Timestamp: Sat, 30 Jul 2011 16:31:08 UTC
    
    
    Message: 'SWFObject' is undefined
    Line: 1283
    Char: 1
    Code: 0
    URI: http://www.mysite/video_admin.php?type=v
    i dont mind going back to the old version i just need to get this working and im soooooooo lost lol


    ok another update, this is becomming maddening lol. once i have this line in the header php

    Code:
    <script type='text/javascript' src='$CONST_LINK_ROOT/swfobject.js'></script>
    I never have to use it again as long as they header php is included correct?


    This is what is driving me nuts, im back on 1.5 and it says its undefined


    Code:
    but am in not defining it on this line? ---> var s1 = new SWFObject('player.swf','player','400','300','9');
    
    
    <script type='text/javascript' src='swfobject.js'></script>
    <script type='text/javascript'>
    var s1 = new SWFObject('player.swf','player','400','300','9');
    s1.addParam('allowfullscreen','true');
    s1.addParam('allowscriptaccess','always');
    s1.addParam('flashvars','file=$CONST_LINK_ROOT/movies/$sql_array->vid_id.flv');
    s1.write('preview');
    </script>

    Another Update. I am back to the original question. null is null or not an object.. in my search i have found this

    found a solution. basically Internet Explorer is crappy and doesnt like the setAttribute property so had to change the onchange handler by directly changing the attrbute for the object like so.
    object.onchange = function() {}

    i have no idea what they means, does that mean i need to change swfobject.js or does that mean i have to change my xml request. and if it is the swfobject i have no clue what they mean or what lines
    Last edited by durangod; 07-30-2011 at 08:14 PM. Reason: updated with new info

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,423
    Thanks
    271
    Thanked 32 Times in 31 Posts
    problem solved, the way i did it was i upgraded my version of swfobject to the new 2.2

    just fyi it is a bit of work to change over, here is a few things that might help you

    first understand that swfobject 1.x works from the inline call method meaning that your script call is usually right above where your run your player code. (nothing in the head)

    2.x works different it works off the object tag on the page, and your javascript call is in your head section.

    very basic here how to: there are options dymanic and static, i chose static, its easier for me, this is for that choice.

    keep your old code with the attributes and stuff you will need it.

    download the swfobject 2.x from the website http://code.google.com/p/swfobject/
    and also download the swfobject_generator i used the html version for my php script.

    just fire up the generator and plug in your values, comment out your old code, the javascript call, the player code and the embed, just comment them out or cut them out and stick them in a notepad, you will need them.

    The code you get in the generator (if your doing php) you need to split up.

    First post the head stuff in your header php (remove any old javascript reference call to the swfobject if its there)

    then grad be div and the object stuff and replace your code on your page that you commented out.

    One quick note, for those who chose php print to print the old swfobject code you will need to remove the print, take care of your quote issue, and also add the php tags to any php variables. fire it up, it should work.

    i hope this helped someone, took me along time to get this right and i hope i can save you some time..

    peace
    Last edited by durangod; 07-30-2011 at 10:44 PM.

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,423
    Thanks
    271
    Thanked 32 Times in 31 Posts
    the only thing i dont know how to do with this is how do i make it give a preview rather than a black background.

    the old code above had

    Code:
    s1.write('preview');
    but i tried adding that into flashvars to the generator and it didnt work.

    maybe someone here knows how to show a preview with swfobject 2.2


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •