A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Problems with fscommand and a asp vbscript page

  1. #1
    Junior Member
    Join Date
    Sep 2002
    Posts
    19

    Problems with fscommand and a asp vbscript page

    Hello,

    I have a problem I hope someone can help me with. I have a database-driven homepage (asp vbscript) and i'm trying to make a swf control the visibility of the layer it's in so a button can trigger the layer's visibility to hidden. Anyway, when I take the fscommand and javascript code and place them in a static html document, the fscommand on my button works fine (in both netscape and ie). However, when I place the same code and layer with the flash movie in my .asp page, I get an error telling me that a script block cannot be placed inside another script block. I know it has something to do with this part of the javascript code:


    if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1)
    {
    document.write('<script language=\"VBScript\"\>\n');
    document.write('On Error Resume Next\n');
    document.write('Sub flu_shot_FSCommand(ByVal command, ByVal args)\n');
    document.write('Call flu_shot_DoFSCommand(command, args)\n');
    document.write('End Sub\n');
    document.write('</script\>\n');
    }


    Is there a way to use fscommand on an asp vbscript page? Any comments would be appreciated.
    Steve

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    the fact that its asp has little to no bearing on what's happening from what i can tell, and if you're already using both asp and javascript - that kind of makes vbscript redundant (i can't think of anything that vbscript can do that you cant do - usually easier - if you have asp and javascript at your disposal - outside the wmi and mse i mean). but anyways - the page is read from top-down - so you probably have your aps openers on top? then the javascript writing the vbscript beneath... which is the script in a script block (the asp script block) - so either call the javascript before the asp since it shouldn't have any dependencies on whatever the asp's doing, and it won't have any effect if it doesnt smell the browsers its looking for, and if it does, it's just an asp compliant vb block anyways so should go in fine... not sure about that though i dont know asp at all... but i have used javascript a time or two, and document write is not only almost always unnecessary but kinda dangerous too - like say you have your page all done and have all these great swf objects and asp functions and javascript so they all work together nice and smooth, then at the bottom you stick

    Code:
    <button onclick="document.write('bye!');">bye!</button>
    that little bastard'll wipe the whole page clean - you'll be left without even so much as html tags, just a blank doc with "bye!" on it. it is controllable, and very useful for things like array construction for image galleries, or dynamic content dependant on user interaction, but i kinda doubt you need it. that said, all it does is exactly what it says: write stuff.

    so we can kill the whole browser sniffer bit (unless you actually need it) and probably the entirety of javascript by changing the red part to
    Code:
    On Error Resume Next
    Sub flu_shot_FSCommand(ByVal command, ByVal args)
    Call flu_shot_DoFSCommand(command, args)
    End Sub
    "sub" means subroutine, which is basically a function without a returned value. anyhow, all that bit's saying is calls to other script that should be?? somewhere in your page...

    (btw i didnt make that code up, that's what the document write would output - i have no idea what/if/how it'll work, i just translated).

    but for a second forget all of the above, cos it sounds like while you've got a few technologies going, they aren't talking to each other - which makes things much easier. if youre just revealing a layer, use inline dhtml (no script blocks necessary), worst case scenario you can have then all trade off some big mafia-boss type variable until everybody's in line - if you can't figger it out, post the complete code.

    good luck.

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