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 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2005
    Location
    Delhi
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to take more arguments .

    Here is my code
    This generates an <object><embed></embed></object>
    Code:
    //v1.0
    //Copyright 2006 Adobe Systems, Inc. All rights reserved.
    function AC_AddExtension(src, ext)
    {
      if (src.indexOf('?') != -1)
        return src.replace(/\?/, ext+'?'); 
      else
        return src + ext;
    }
    
    function AC_Generateobj(objAttrs, params, embedAttrs) 
    { 
      var str = '<object ';
      for (var i in objAttrs)
        str += i + '="' + objAttrs[i] + '" ';
      str += '>';
      for (var i in params)
        str += '<param name="' + i + '" value="' + params[i] + '" /> ';
      str += '<embed ';
      for (var i in embedAttrs)
        str += i + '="' + embedAttrs[i] + '" ';
      str += ' ></embed></object>';
    
      document.write(str);
    }
    
    function AC_FL_RunContent(){
      var ret = 
        AC_GetArgs
        (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
         , "application/x-shockwave-flash"
        );
      AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    
    function AC_SW_RunContent(){
      var ret = 
        AC_GetArgs
        (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
         , null
        );
      AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
    }
    
    function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
      var ret = new Object();
      ret.embedAttrs = new Object();
      ret.params = new Object();
      ret.objAttrs = new Object();
      for (var i=0; i < args.length; i=i+2){
        var currArg = args[i].toLowerCase();    
    
        switch (currArg){	
          case "classid":
            break;
          case "pluginspage":
            ret.embedAttrs[args[i]] = args[i+1];
            break;
          case "src":
          case "movie":	
            args[i+1] = AC_AddExtension(args[i+1], ext);
            ret.embedAttrs["src"] = args[i+1];
            ret.params[srcParamName] = args[i+1];
            break;
          case "onafterupdate":
          case "onbeforeupdate":
          case "onblur":
          case "oncellchange":
          case "onclick":
          case "ondblClick":
          case "ondrag":
          case "ondragend":
          case "ondragenter":
          case "ondragleave":
          case "ondragover":
          case "ondrop":
          case "onfinish":
          case "onfocus":
          case "onhelp":
          case "onmousedown":
          case "onmouseup":
          case "onmouseover":
          case "onmousemove":
          case "onmouseout":
          case "onkeypress":
          case "onkeydown":
          case "onkeyup":
          case "onload":
          case "onlosecapture":
          case "onpropertychange":
          case "onreadystatechange":
          case "onrowsdelete":
          case "onrowenter":
          case "onrowexit":
          case "onrowsinserted":
          case "onstart":
          case "onscroll":
          case "onbeforeeditfocus":
          case "onactivate":
          case "onbeforedeactivate":
          case "ondeactivate":
          case "type":
          case "codebase":
            ret.objAttrs[args[i]] = args[i+1];
            break;
          case "width":
          case "height":
          case "align":
          case "vspace": 
          case "hspace":
          case "class":
          case "title":
          case "accesskey":
          case "name":
          case "id":
          case "tabindex":
            ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
            break;
          default:
            ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
        }
      }
      ret.objAttrs["classid"] = classid;
      if (mimeType) ret.embedAttrs["type"] = mimeType;
      return ret;
    }
    Please see this
    http://www.adriantnt.com/support/cli..._this_control/

    Now I want to take more arguments(like all of them below)

    Code:
    <OBJECT
    	CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    	
    	CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"
    	ID=testmovie width="31" height="31" border="0" style="position:absolute; left:294px; top:138px;  z-index:10000; cursor:hand;"   id="obj1" name="obj1" title="Plant new ideas">
    	<PARAM NAME="MOVIE" VALUE="icon_shovel2.swf">
    	
    	<PARAM NAME="QUALITY" VALUE="high">
    	<PARAM NAME="SCALE" VALUE="SHOWALL">
    
    
    	<EMBED
    		NAME="testmovie"
    		SRC="icon_shovel2.swf"
    		WIDTH="31"
    		HEIGHT="31"
    	
    		QUALITY="high"
    		SCALE="SHOWALL" 
    		swLiveConnect="true"
    		PLUGINSPAGE="http://www.macromedia.com/go/flashplayer/">
    	</EMBED>
    </OBJECT>
    like i will need swLiveConnect="true" but how to do this?

  • #2
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    Make that entire episode a variable. Watch out for line breaks and escape the quotes.


  •  

    Posting Permissions

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