dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [F8] Textfile not loading properly.....

  1. #1
    Junior Member
    Join Date
    Oct 2006
    Posts
    19

    [F8] Textfile not loading properly.....

    Hi,

    have a problem loading textfiles into my project.
    The weird thing is that sometimes the textfile actualy loads, and sometime it doesnt..(this randomly)

    The basic idea is to load a swf(from a xml file) onto the mainstage (this seems to be working).. then load a textfile into the fresly loaded SWF..

    i use the code below to load the swf, and the textfile.
    Code:
    this.m_menu_array[i].onRelease = function() {
    				loadMovie(this.data.Clink,"SwfLoader_CLP");
    				// loading data to text fields.
    					var _myLV=new LoadVars();
    					_myLV.onData = function(src:String):Void{
    						if (src!=undefined){
    							_root.SwfLoader_CLP.Content_txt.html= true;
    							_root.SwfLoader_CLP.Content_txt.htmlText=src;
    						}else {
    							_root.SwfLoader_CLP.Content_txt.html= true;
    							_root.SwfLoader_CLP.Content_txt.htmlText="No Data Availeble";
    						}
    					}
    					_myLV.load(this.data.Ctext);
    					//getURL(this.data.href, "_blank");
    			};
    can anyone help me on this.

  2. #2
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    1.) maybe the external.swf is not loading and initilizing the textFields fast enough for it to populate? (suggestion)

    also maybe try using onLoad instead of onData.. (dont use onData much so I guess Im unfamiliar with it)

    alternately..you could put the load textFile code in the external.swf (with no references to _root).. and see if that eliminates the problems..

  3. #3
    Junior Member
    Join Date
    Oct 2006
    Posts
    19
    Quote Originally Posted by whispers
    1.) maybe the external.swf is not loading and initilizing the textFields fast enough for it to populate? (suggestion)

    also maybe try using onLoad instead of onData.. (dont use onData much so I guess Im unfamiliar with it)

    alternately..you could put the load textFile code in the external.swf (with no references to _root).. and see if that eliminates the problems..
    thanx..

    You might be right about the swf not loading fast enough to get the text in.
    so have to fine another option.

    looked at your last suggestion. now i end up with "undefined" in the textfield of the swf. somewhere the src (wich contains the textfile isn't passed to the loaded swf)

  4. #4
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    did you take out the _root in yoru code.. if you move the above code to your external.swf the references to _root will NO longer mean the external.swf that has this code.. once it gets loaded into a MAIN.swf.. the MAIN.swf becomes _root.


    alternately.. you could use a preloader the external.swf you are loading (NOT IN THE EXTERNAL.SWF itself though) and once it fully loads you can put the load data into the textFields code in the onLoad method()..

    ( believe it to be the external.swf is NOT loaded fast enough to get the data your sending it..

  5. #5
    Junior Member
    Join Date
    Oct 2006
    Posts
    19
    Did exactly as you said, but no result.

    Thought of the preloader solution and came up with the folowing.
    Code:
    			this.m_menu_array[i].onRelease = function() {
    				var mcListener:Object = new Object();
    					mcListener.onLoadInit = function(SwfLoader_CLP:MovieClip):Void{
    						var _myLV=new LoadVars();
    						_myLV.onData= function(src:String):Void{
    							if (src!=undefined){
    								_root.SwfLoader_CLP.Content_txt.html=true;
    								_root.SwfLoader_CLP.Content_txt.htmlText=src;
    							}else {
    								_root.SwfLoader_CLP.Content_txt.html=true;
    								_root.SwfLoader_CLP.Content_txt.htmlText= "Unable to load datafile.";
    							}
    						}
    						_myLV.load(this.data.Ctext);
    					}
    					var mcLoader:MovieClipLoader= new MovieClipLoader();
    					mcLoader.addListener(mcListener);
    					mcLoader.loadClip(this.data.Clink, _root.SwfLoader_CLP);
    			}
    The textfile will not load though but atleast now i get the right error msg.
    If i only find the error in this code im home free...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center