2 Replies Latest reply on Mar 3, 2009 12:12 PM by combustion007

    Creating htmlLoader() issues

    combustion007 Level 1
      Hello Everyone,

      I have been trying to create a htmlLoader by following the Adobe Live docs:
      http://livedocs.adobe.com/flex/3/html/help.html?content=ProgrammingHTMLAndJavaScript_02.ht ml

      As soon as I copy paste the code from Adobe, my IDE spits out the following errors:
      "Access of undefined property html".

      Can someone help with this please.
        • 1. Re: Creating htmlLoader() issues
          Level 7

          "combustion007" <webforumsuser@macromedia.com> wrote in message
          news:gojf97$sbf$1@forums.macromedia.com...
          > Hello Everyone,
          >
          > I have been trying to create a htmlLoader by following the Adobe Live
          > docs:
          >
          > http://livedocs.adobe.com/flex/3/html/help.html?content=ProgrammingHTMLAndJavaSc
          > ript_02.html
          >
          > As soon as I copy paste the code from Adobe, my IDE spits out the
          > following
          > errors:
          > "Access of undefined property html".
          >
          > Can someone help with this please.
          >
          > <?xml version="1.0" encoding="utf-8"?>
          > <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml"
          > layout="absolute" creationComplete="initApp()">
          > <mx:Script>
          > <![CDATA[
          > import mx.messaging.channels.StreamingAMFChannel;
          > import flash.events.*;
          > import flash.filesystem.*;
          > import flash.net.*;
          > import flash.html.*;
          > import flash.html.script.*;
          > import mx.controls.*;
          > import mx.containers.*;
          > import mx.core.*;
          >
          > public var loc:String;
          > private function initApp():void
          > {
          > browseBtn.addEventListener(MouseEvent.CLICK, browseHandler);
          > //this.hLoader.location = '';
          > }
          >
          > private function browseHandler(event:Event):void
          > {
          > //Alert.show("BROWSE IS CLICKED");
          >
          > var f:File = new File();
          > f.addEventListener(Event.SELECT,pdfHandler);
          > var filter:FileFilter = new FileFilter("PDF FILES","*.pdf");
          > f.browseForOpen("Please Select",[filter]);
          > }
          >
          > private function pdfHandler(event:Event):void
          > {
          > var f:File = event.target as File;
          >
          >
          > }
          >
          > var container:Sprite;
          > var html:HTMLLoader = new HTMLLoader;
          > html.width = 400;
          > html.height = 600;
          > var urlReq:URLRequest = new URLRequest(" http://www.adobe.com/");
          > html.load(urlReq);
          > container.addChild(html);
          >
          >
          >
          > ]]>
          > </mx:Script>
          > <mx:Button x="246" y="56" label="Browse PDF" id="browseBtn"/>
          >
          >
          >
          > </mx:WindowedApplication>

          It looks like you forgot to write the function that should be enclosing

          var container:Sprite;
          var html:HTMLLoader = new HTMLLoader;
          html.width = 400;
          html.height = 600;
          var urlReq:URLRequest = new URLRequest(" http://www.adobe.com/");
          html.load(urlReq);
          container.addChild(html);


          like this:

          private function init():void {
          var container:Sprite;
          var html:HTMLLoader = new HTMLLoader;
          html.width = 400;
          html.height = 600;
          var urlReq:URLRequest = new URLRequest(" http://www.adobe.com/");
          html.load(urlReq);
          container.addChild(html);
          }

          HTH;

          Amy


          • 2. Re: Creating htmlLoader() issues
            combustion007 Level 1
            Thanks a million, Amy.