Skip to main content
This topic has been closed for replies.

1 reply

Inspiring
January 17, 2013

i use this code but got error

package {

import flash.display.Sprite;

import flash.html.HTMLLoader;

import flash.net.URLRequest;

import flash.display.SimpleButton;

public class bhtml extends SimpleButton

{

public function bhtml()

{

var html:HTMLLoader = new HTMLLoader();

var urlReq:URLRequest = new URLRequest("http://www.adobe.com/");

html.width = stage.stageWidth;

html.height = stage.stageHeight;

html.load(urlReq);

addChild(html);

}

}

}

but got the error (Call to possibly undefined method addChild)

im using Flash CS5.5 (Publishing in Air in Android)

Inspiring
January 17, 2013

SimpleButton can have no children.

it should say:

public class bhtml extends MovieClip

Inspiring
July 1, 2013

i try this and its workig. thx boss

package {

     import flash.display.SimpleButton;

     import flash.display.Sprite;

     import flash.net.navigateToURL;

     import flash.net.URLRequest;

     import flash.net.URLRequestMethod;

     import flash.net.URLVariables;

     import flash.events.MouseEvent;

    public class bAEForm extends SimpleButton {

          public function bAEForm() {

               this.addEventListener(MouseEvent.CLICK,clickF);

          }

               private function clickF(e:MouseEvent):void {

                         var url:String = "http://www.google.com";

                         var request:URLRequest = new URLRequest(url);

                         var variables:URLVariables = new URLVariables();

                         variables.exampleSessionId = new Date().getTime();

                         variables.exampleUserLabel = "guest";

                         request.data = variables;

                         request.method = URLRequestMethod.POST;

                         navigateToURL(request,"_self");

                     }

          }

}