Html in MovieClip

Need directions regarding the better ways of doing this.

Page 1 of 1

0 Replies - 2073 Views - Last Post: 05 January 2010 - 06:33 AM

#1 maxrock  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 70
  • Joined: 13-September 09

Html in MovieClip

Post icon  Posted 05 January 2010 - 06:33 AM

Hi all,

I've been trying to embed an entire html page with all the graphics and text into a movieclip.

I used a dynamic textfield within the movieclip and used the URLLoader to load html text into the textfield.

Also i used the UIScrollBar.

Everything works except that the images remain where they are while scrolling.

I need the scrolling effect and so haven't used the wordwrap on the textfield.

import flash.net.URLLoader;
import fl.controls.UIScrollBar;
import flash.display.MovieClip;
import flash.events.Event;


var info_text = new TextField();
	info_text.x = 0;
	info_text.y = 0;
	info_text.width = 480;
	info_text.height = 440;
	info_text.border=true;
	info_text.background=true;

   var MySb:UIScrollBar = new UIScrollBar();
   var MySb1:UIScrollBar = new UIScrollBar();

   MySb.direction = "horizontal";
   MySb.setSize(info_text.width, info_text.height); 
   MySb.move(info_text.x, info_text.height + info_text.y);

   MySb1.direction = "vertical";
   MySb1.setSize(info_text.width, info_text.height); 
   MySb1.move(info_text.x + info_text.width, info_text.y);

   this.addChild(info_text);
   this.addChild(MySb);
   this.addChild(MySb1);


   var myURLLoader:URLLoader = new URLLoader();
   myURLLoader.load(new URLRequest("myhtml.html"));
   myURLLoader.dataFormat = URLLoaderDataFormat.TEXT;
   myURLLoader.addEventListener(Event.COMPLETE,  completeHandler); 


function completeHandler(event:Event):void
{
	info_text.htmlText = event.target.data;
		MySb.scrollTarget = info_text;
	MySb1.scrollTarget = info_text;
	
}






So I needed to know whether there is any other way of doing this so that i could get most of the layout settings of the html into movieclip so that i can just place the movieclip where ever i want that page to be displayed. Or is there any corrections to be done to this code.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1