Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function populateSubSections(mc:MovieClip, cntnt:Object):void
- {
- var cntnt_tot:uint = cntnt.sub.length();
- var cntnt_int:uint = 0;
- function createSub():void
- {
- var thisSub:subsec_mc = new subsec_mc();
- thisSub.x = mc.width;
- if ( cntnt_int > 0 ) thisSub.x += 50;
- mc.addChild(thisSub);
- panel_points[mc.name.split("_")[1]].push(thisSub.x);
- subNavTitles[mc.name.split("_")[1]].push(cntnt.sub[cntnt_int].nav);
- fillText(MovieClip(thisSub), cntnt.sub[cntnt_int]);
- }
- createSub();
- function fillText(mc:MovieClip,obj:Object):void
- {
- var tb_int:uint = 0;
- var tb_width:Number = 320;
- var tb_height:Number = 250;
- var tb_spacing:Number = 10;
- function setTitle():void
- {
- mc.txt_title.txt.autoSize = TextFieldAutoSize.LEFT;
- mc.txt_title.txt.text = obj.title;
- /*if(mc.txt_title.width > 300){
- mc.txt_title.width = 300;
- mc.txt_title.scaleY = mc.txt_title.scaleX;
- }*/
- createTB(obj.text);
- }
- setTitle();
- function createTB(str:String):void
- {
- var tf:TextField = new TextField();
- mc.txt_descrip.addChild(tf);
- if ( tb_int == 0 ) {
- tf.width = tb_width;
- tf.height = tb_height - mc.txt_title.y+mc.txt_title.height;
- tf.y = mc.txt_title.y+mc.txt_title.height;
- } else {
- tf.width = tb_width;
- tf.height = tb_height;
- }
- if ( tb_int > 0 ) tf.x = (tb_width+tb_spacing)*tb_int;
- tf.multiline = true;
- tf.wordWrap = true;
- tf.selectable = false;
- tf.mouseWheelEnabled = false;
- tf.embedFonts = true;
- tf.antiAliasType = "normal";
- tf.defaultTextFormat = myTextFormat;
- tf.htmlText = str;
- tb_int++;
- if ( getTextOverflow(tf).length > 0 ) {
- createTB(getTextOverflow(tf));
- } else {
- placeImg(mc, obj);
- }
- }
- function getTextOverflow(tf:TextField):String
- {
- var overflow:String = '';
- for ( var i:uint = 0 ; i < tf.maxScrollV-1 ; i++ ) {
- overflow+=tf.getLineText(tf.bottomScrollV+i);
- }
- return overflow;
- }
- }
- function placeImg(mc:MovieClip, obj:Object):void
- {
- if ( obj.img.length() > 0 && obj.img != "null" ) {
- loadImg();
- } else {
- mc.separator.x = mc.txt_descrip.width+20;
- loadnext();
- }
- function loadImg():void {
- var loader:Loader = new Loader();
- loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
- var request:URLRequest = new URLRequest(assets+obj.img);
- loader.load(request);
- trace("loading: "+obj.img)
- function loadComplete(e:Event):void {
- var image:Bitmap = new Bitmap(e.target.content.bitmapData);
- image.smoothing = true;
- mc.sub_img.addChild(image);
- mc.sub_img.x = mc.txt_descrip.width+25;
- if ( cntnt_int < cntnt_tot-1 ) {
- var sep:separator_mc = new separator_mc();
- mc.addChild(sep);
- sep.x = mc.width + 30
- }
- loadnext();
- }
- }
- function loadnext():void {
- cntnt_int++;
- if ( cntnt_int < cntnt_tot ) {
- createSub();
- } else {
- fillData();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment