DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Graphics and Multimedia (http://www.daniweb.com/forums/forum28.html)
-   -   UILoader and TileList not loading (http://www.daniweb.com/forums/thread157634.html)

ceyesuma Nov 16th, 2008 12:42 am
UILoader and TileList not loading
 
Would someone have time to look at some classes and an XML to try to tell me why nothing is loading?

I have:

A simple interface with two combo boxes (that do load) and they are linked to two separate classes. One cb class should load an UILoader class and the other cb class initiates a TileList (linked) class. each of the 4 classes are linked to there components.
additionally I have two seperate classes to handle the XML and the URLRequest?
Thanks
Steve

ceyesuma Nov 16th, 2008 10:54 am
uiloader and Tilelist loading but not displaying
 
my uiloader
partial code
sourceValue=theXML.key[key].swfFile;
trace("///// ui  key "+sourceValue+" //////////////////");
uiImage.source=sourceValue;

If my url is correct and it is in sourcValue which it is. Shouldn't uiImage.source=sourcValue display the file?


likewise

tilelist partial code
var imageImage:String=theXML.key[tImage].swfFile;
trace("////////////////// "+imageImage+" //////////////////");
arrayImage.push({source:imageImage});

                        }
dp=new DataProvider(arrayImage);
tlImage.dataProvider=dp;


all the correct URL are in the arrayImage[] and the only thing I have left is frame one(action) in the .fla which is:



the tilelist


var cbMajorComponent:CBMajorComponent=new CBMajorComponent();

cbMajorComponent.cbMajor.setSize(200, 22);
cbMajorComponent.cbMajor.prompt = "Select a Major Key";
cbMajorComponent.cbMajor.editable=false;
cbMajorComponent.cbMajor.rowCount=15;
cbMajorComponent.cbMajor.width=110;
cbMajorComponent.cbMajor.move(0,0);
cbMajorComponent.cbMajor.x=10;
cbMajorComponent.cbMajor.y=20;

this.addChild(cbMajorComponent.cbMajor);



var cbMinorComponent:CBMinorComponent=new CBMinorComponent();

cbMinorComponent.cbMinor.setSize(200, 22);
cbMinorComponent.cbMinor.prompt = "Select a Minor Key";
cbMinorComponent.cbMinor.editable=false;
cbMinorComponent.cbMinor.rowCount=15;
cbMinorComponent.cbMinor.width=110;
cbMinorComponent.cbMinor.move(0,0);
cbMinorComponent.cbMinor.x=10;
cbMinorComponent.cbMinor.y=50;

this.addChild(cbMinorComponent.cbMinor);




var uiImageComponent:UIImageComponent=new UIImageComponent();

uiImageComponent.uiImage.setSize(50,50);
uiImageComponent.uiImage.x=135;
uiImageComponent.uiImage.y=13;
//uiImageComponent.uiImage.width=110;
//uiImageComponent.uiImage.height=50;

this.addChild(uiImageComponent.uiImage);


var tlImageComponent:TLImageComponent=new TLImageComponent();

tlImageComponent.tlImage.move(135,185);
tlImageComponent.tlImage.width=375;
tlImageComponent.tlImage.height=120;
tlImageComponent.tlImage.columnWidth=160;
tlImageComponent.tlImage.rowHeight=185;

this.addChild(tlImageComponent.tlImage);

ceyesuma Nov 18th, 2008 6:21 pm
UIloader not dispalying
 
I am having a problem with dispalying the UILoader on the mcContainer I have on my main

timeline;

I wrote a class (below) that loads fine
meaning:
sourceValue=theXML.key[key].swfFile;
this code when traced outputs all the correct URL's from the XML.



package chromatic.load_files{
        import fl.containers.UILoader;
        import flash.display.MovieClip;
        import flash.events.Event;
        import fl.data.DataProvider;
        import flash.net.URLLoader;
        import flash.net.URLRequest;
        import flash.net.*;

        public class UIImageComponent extends MovieClip {

                public var uiImage:UILoader=new UILoader();
                public var dp:DataProvider=new DataProvider();
                private var dataLoader:URLLoader=new URLLoader();
                private var theXML:XML=new XML();
                private var listURL:URLRequest=new URLRequest();

                private var arrayImage:Array=new Array();

                private var singleImage:String;
                private var key:String;
                private var fileName:String;
                private var sourceValue:String=null;
                private var evtIndex:int;
                private var evtName:String;
                private var sel:Number=-1;
                private var xmlList:XMLList;

                public function UIImageComponent():void {


                }
                public function init(fileName,key):void {
                        this.fileName=fileName;
                        this.key=key;
                        setfileName(fileName);
                        setKey(key);
                        setupComponent(fileName,key);
                }
                private function setupComponent(fileName,key):void {
                        this.fileName=fileName;
                        this.key=key;
                        uiImage=new UILoader();
                        uiImage.setSize(50,50);
                        uiImage.x=135;
                        uiImage.y=13;
                        //uiImage.width=110;
                        //uiImage.height=50;
                        theXML=new XML(fileName);
                        theXML.ignoreWhitespace=true;
                        listURL=new URLRequest(theXML);
                        dataLoader=new URLLoader(listURL);
                        try {
                                dataLoader.load(listURL);
                        } catch (error:Error) {
                                trace("Unable to load requested document");
                        }

                        dataLoader.addEventListener(Event.COMPLETE,dataLoaded);
                        //uiImage.addEventListener(Event.CHANGE, selectedName);
                        //uiImage.addEventListener(Event.CHANGE,changeEvent);
                        //uiImage.addEventListener(Event.COMPLETE,doTrace);
                        //uiImage.addEventListener(Event.RESIZE,doTrace);
                }
                private function dataLoaded(evt:Event):void {                       
                        theXML=XML(dataLoader.data);
                        //trace("////////////////// UI "+theXML);
                        key=getKey();

                        sourceValue=theXML.key[key].swfFile;
                        trace("///// ui  key "+sourceValue+" //////////////////");
                        uiImage.source=sourceValue;
                }
                /*
                private function selectedName():void {
                /*Combobox evt.target.setupComponent  cannot have spaces (as we have).So

until
                * I learn how to rid a string of spaces thus the var key
                */


                /*this bloct to be replaced by an hotspot event
                uiImageComponent=new UIImageComponent
               
                key=concatArray[evtIndex];
                uiImageComponent.setfileName(this.fileName);
                uiImageComponent.setkey(this.key);
                uiImageComponent();
               
                }
                private function doTrace(evt:Event):void {
                trace(uiImage.width);
                uiImage.scaleContent=true;
                uiImage.maintainAspectRatio=false;
                }
                */
                private function changeEvent(evt:Event):void {
                        trace(" You selected a key");
                }
                public function setfileName(fileName):void {

                        this.fileName=fileName;

                }
                public function getfileName():String {
                        return fileName;
                }
                public function setKey(key):void {

                        this.key=key;

                }
                public function getKey():String {
                        return key;
                }
        }
}


Now when I go to the actions layer keyframe of the timeline I have:

/*
import chromatic.load_files.Main;
var main:Main=new Main();
main;
*/

var cbMajorComponent:CBMajorComponent=new CBMajorComponent();
var cbMinorComponent:CBMinorComponent=new CBMinorComponent();
var uiImageComponent:UIImageComponent=new UIImageComponent();
var tlImageComponent:TLImageComponent=new TLImageComponent();


stage.addChild(cbMajorComponent.cbMajor);
stage.addChild(cbMinorComponent.cbMinor);
mcContainer.addChild(uiImageComponent.uiImage);
mcContainer.addChild(tlImageComponent.tlImage);


Here the combobox's function fine yet they have listeners and selectedItem() traces

the above mentioned URLS but nothing appears in the mcContainer.

Could someone help me to learn how to an image to dispay here?


Thanks
ceyesuma

ceyesuma Nov 19th, 2008 6:58 pm
uiloader
 
Can I get some help dispaying a loaded uiloader?
Thanks


All times are GMT -4. The time now is 6:22 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC