[Javascript] Preloader is not showed up.

David Lovering dlovering at gazos.com
Thu Sep 4 08:46:37 CDT 2003


I haven't run all the permutations, but the text field creator needs to be a
client of a form (at least if we're presuming this is canonical
W3C-compliant), and the child function presumes that the working form is a
child of a frame.  My experience tells me that "_parent" construct doesn't
always work well, as it simply presumes that the parent frame of the object
in question is what is required -- and if you are deep within a frame, this
simply points back to the frame you are already in  (at least in the MSIE
circumstances I am familiar with).  I would suggest experimenting with
methods such as

var frame_doc =
window.parent.parent.top.document.frames["my-target-frame"].document

in order to define the pointer to another frame in a complicated multi-frame
environment.  Obviously, "my-target-frame" will correspond to the name/id of
the real frame you want to jump into.  If the frames are anonymous, you can
simply use indexes, i.e;

var frame_doc = window.parent.parent.top.document.frames[3].document

just as an example.  This is the only mechanism I can think of which would
cause the script to work in one frame, but not in another.  The
'parent.parent' trick forces the DOM map pointer to move beyond the current
frame in a nested-frame environment, (which may not be absolutely necessary
in every instance), and the "top" reference moves to the ultimate parent
document after we've navigated to the top of the frame stack.

Also, remember that each frame is (to a large extent) a whole new document,
and that not every function, definition, etc. will necessarily appear
globally referenced within them.  I'd suggest putting some existence
checkers in the top of each of your functions in order to make certain that
the necessary objects/frames/forms are appearing properly.

Another thing to ensure is that the preloader script is always launched
(presumably by an event handler) underneath an object which is capable of
spawning a child text field -- most notably a form or a table.  If "this"
devolves to something that CAN'T spawn a text field, then you're hosed right
there.

Mind you, all this is the result of a very quick overview, and I might have
overlooked something.

-- Dave Lovering


----- Original Message ----- 
From: "Prabu Subroto" <prabusubroto at yahoo.com>
To: "JavaScript Milis" <javascript at LaTech.edu>
Sent: Thursday, September 04, 2003 2:35 AM
Subject: [Javascript] Preloader is not showed up.


> Dear my friends....
>
> I wrote this actionsript to show up a preloader :
> this.createTextField("texte", 100, 0, -20, 100, 20);
>  texte.multiline = false;
>  texte.wordWrap = false;
>  texte.border = true;
>  myFormat = new TextFormat();
>  myFormat.bold = true;
>  myFormat.font = "Arial";
>  myFormat.align = "center";
>  myFormat.size = 12
>  this.createEmptyMovieClip("bar", 102);
>  bar.beginFill(0x6600FF, 40);
>  bar.moveTo(0, -20);
>  bar.lineTo(100, -20);
>  bar.lineTo(100, 0);
>  bar.lineTo(0, 0);
>  bar.lineTo(0, -20);
>  bar.endFill();
>  this.onEnterFrame = function() {
>  charge =
>
> Math.round((_level0.getBytesLoaded())/(_level0.getBytesTotal())*100);
>  pour = Math.round(charge) add " % - LAM AG";
>  texte.text = pour;
>  texte.setTextFormat(myFormat);
>  bar._xscale = Math.round(charge);
>  if (_level0.getBytesLoaded() ==
> _level0.getBytesTotal()) {
>  _parent.nextFrame();
>  }
>  stop();
>  };
>
> I put this script onto frame 1 (1st frame) and if I do
> TestMovie than lookslike this script works properly.
> But than if I put it onto the 1-st frame of my movie
> (intro.swf) than I can not see the preloader anymore.
> My movie that contents the preloader actionscript is
> already uploaded on my domain but still doesn't
> display the preloader program.
>
> I put the script onto the 1-st frame of the layer
> which I located on the top position so I think it is
> not because the preloader is covered by other
> layers...
>
> Please tell me why. Thank you very much in advance.
>
> Greetings...
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>





More information about the Javascript mailing list