A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: window Focus new issue?

  1. #1
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194

    window Focus new issue?

    Hi,

    I've noticed recently how theres a weird frame around my Flash movie, which goes away when I click on the window. I think Flash has always needed the user to click on the window to give it focus (or am I remembering wrong?), but is there anyway around this? can the window be giving focus with actionscript somehow?

    thanks for any help
    boombanguk

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    the browser takes precedence until the movie is clicked,
    unless you add a function in your html :

    PHP Code:
    <script>
    function 
    focusIt(){
    if(
    document.layers){
    document.bob.focus()
    }
    else if(
    document.getElementById){
    document.getElementById("bob").focus()
    }
    else if(
    document.all){
    document.all["bob"].focus()
    }
    }
    </
    script>
    </
    head>
    <
    body onload="focusIt()">

    <
    object classid ... ID="bob" >
    <
    param name=movie value="bob.swf">
    <
    embed name="bob" ... src="bob.swf" 

  3. #3
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    im not sure what I should set "bob" too? in my html for object id theres just a long number, not a name??

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    post the html source code that contains the <OBJECT> and <EMBED> tags for your movie and I might be able to answer

  5. #5
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    this from the source,thanks:

    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="800" height="600">
    <param name="movie" value="index.swf">
    <param name="quality" value="high"><param name="BGCOLOR" value="#003366">
    <embed src="index.swf"

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    PHP Code:
    <HTML>
    <
    HEAD>
    <
    TITLE>focus movie</TITLE>


    <
    script Language="Javascript">
    <!--

    function 
    focusTheMovie(){
     if(
    document.layers){
      
    document.bob.focus()
    }
     else if(
    document.getElementById){
      
    document.getElementById("bob").focus()
    }
     else if(
    document.all){
      
    document.all["bob"].focus()
     }
    }
    //-->
    </script>
    </
    HEAD>
    <
    body onload="focusTheMovie();"  bgcolor="#003366">

    <
    object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.ca
    b#version=6,0,29,0" 
    width="800" height="600" id="bob">
    <
    param name="movie" value="index.swf">
    <
    param name="quality" value="high">
    <
    param name=bgcolor value=#003366>
    <embed name="bob" 
    src="index.swf" 
    quality="high" 
    bgcolor=#003366  
    pluginspage="http://www.macromedia.com/go/getflashplayer"
    type="application/x-shockwave-flash" width="800" height="600"
    ></embed></object>
    </
    BODY>
    </
    HTML

  7. #7
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    did it work for you ??

  8. #8
    Amiga freak Ironclaw's Avatar
    Join Date
    Jan 2001
    Location
    Sweden
    Posts
    1,650
    Didn't work for me, just tried it.

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    microsoft has changed the way IE handles plugins -
    http://blog.deconcept.com/2005/12/15...-flash-plugin/

    have a look at FlashObject: Javascript Flash detection and embed script -
    http://blog.deconcept.com/flashobject/

  10. #10
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    hi, thanks, I just posted your reply to the issue on the other thread thats running about it. Iron claw said that, that your solution didnt work?? anyone know why it didn't work? it looks pretty close to the solution here..

    http://www.thinkydinky.com/click_to_...s_control.html

  11. #11
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    In IE 6.0.29, the code below works, it focuses the swf without user interaction.
    Focus is given to an input textfield with - Selection.setFocus("myText");
    and you can type without clicking into the movie.
    It fails in FireFox, but I'm sure someone can post the workaround

    focus.html -
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <
    HTML>
    <
    HEAD>
    <
    TITLE>focus the movie</TITLE>
    <
    script src=focus.js></script>
    </
    HEAD>
    <
    BODY onload="focusBob()" bgcolor="#7DC6BD" scroll="auto" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" 
    <
    TABLE HEIGHT='100%' WIDTH='100%'><CENTRE>
    <
    TR><TD>
    <
    script>loadBob();</script></CENTER></TD></TR></TABLE>
    </
    BODY>
    </
    HTML
    focus.js -
    PHP Code:
    function loadBob()
    {
        
    output "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\"  WIDTH=\"100%\" HEIGHT=\"100%\" id=\"bob\" ALIGN=\"\">";
        
    output += "<param NAME=movie VALUE=\"focus.swf\">";
        
    output += "<param NAME=loop VALUE=false>";
        
    output += "<param NAME=menu VALUE=false>";
        
    output += "<param NAME=quality VALUE=high>";
        
    output += "<param NAME=bgcolor VALUE=#7DC6BD><EMBED src=\"focus.swf\" loop=false menu=false quality=high bgcolor=#7DC6BD  WIDTH=\"100%\" HEIGHT=\"100%\" NAME=\"bob\" ALIGN=\"\"  TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED></object>";
        
    document.write(output);
    }
    function 
    focusBob(){
     if(
    document.layers){
      
    document.bob.focus()
    }
     else if(
    document.getElementById){
      
    document.getElementById("bob").focus()
    }
     else if(
    document.all){
      
    document.all["bob"].focus()
     }

    tested online with -
    http://www.jackleaman.co.uk/test/focus/focus.html

  12. #12
    Member
    Join Date
    Jan 2003
    Location
    Dallas
    Posts
    48
    Thank you Thank You
    for this post... why did thisd seem to happen all of the sudden. did i just miss it and it was always there

    Thanks... worked for me

    TM
    Peace be the journey and Beyond

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center