A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: setting visibility based on the load

  1. #1
    Senior Member
    Join Date
    Jan 2003
    Posts
    332

    setting visibility based on the load

    so i have some thumbnails for a gallery and im trying to make them only appear if the user has loaded a thumbnail for it. i will let the code speak...

    if (_root.mainarea.six.galleries[thumbnail].blank.myBytes <= 100) {

    _root.mainarea.six.galleries[thumbnail]._visible = true;


    } else {
    _root.mainarea.six.galleries[thumbnail]._visible = false;


    }
    }


    i cant seem to get the operator or the measuring correct. is there some glaring error in the "<=" or something ?

  2. #2
    Senior Member
    Join Date
    Jun 2009
    Posts
    171
    Use 0 & 1 instead of True & False....

    invisible:
    _visible = 0;

    visible:
    _visible = 1;

  3. #3
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Use 0 & 1 instead of True & False

    this will not make any difference as the values are totally interchangable

    F_M - what do you get from this trace -

    trace(_root.mainarea.six.galleries[thumbnail].blank.myBytes);

  4. #4
    Senior Member
    Join Date
    Jun 2009
    Posts
    171
    hmm...never knew

  5. #5
    Senior Member
    Join Date
    Jan 2003
    Posts
    332
    a_m_d

    it says "undefined"....hmm. a clue ?

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    do you get any output by tracing the result within an OEF loop
    (code on main timeline, same frame as your path .. _root.mainarea....... )

    this.onEnterFrame = function(){
    trace(_root.mainarea.six.galleries[thumbnail].blank.myBytes);
    };

  7. #7
    Senior Member
    Join Date
    Jan 2003
    Posts
    332
    so i put this as an OEF in the gallery section and instead of having the path include the result of a variable ([thumbnail]) i wrote it in so the path is:

    this.onEnterFrame = function(){
    trace(_root.mainarea.six.galleries.galleryone1.bla nk.myBytes);
    };

    and that just gives me another 'undefined' in the output.

    i just made a test movie that just has a jpeg in a MC and put the same trace code on and it says 'undefined' as well:

    this.onEnterFrame = function(){
    trace(this.tester.myBytes);
    };

  8. #8
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    where does myBytes come from ?
    how are you setting this variable ?

    try tester.getBytesLoaded()

    have a read of the Help Files -
    ActionScript 2.0 Language Reference
    ActionScript classes > MovieClipLoader

    This class lets you implement listener callbacks that provide status information while SWF, JPEG, GIF, and PNG files are being loaded into movie clips.

  9. #9
    Senior Member
    Join Date
    Jan 2003
    Posts
    332
    ok, thanks for your help with this AMD. i have got the trace thing working now but my test cant seem to distinguish between a thumbnail that has been loaded with a jpeg and one that hasnt now:

    onClipEvent (load) {
    initial = "galleryone";
    thenumber = 1;
    textnumber = 1;
    thumbnail = initial + thenumber;
    thumbimage = "thumb_" + thumbnail;
    loadMovie("images/"+[thumbimage]+ ".jpg", _root.mainarea.six.galleries[thumbnail].blank)

    _root.mainarea.six.galleries[thumbnail].blank.getBytesLoaded()

    trace(_root.mainarea.six.galleries[thumbnail].blank.getBytesLoaded());

    if (_root.mainarea.six.galleries[thumbnail].blank.bytesLoaded <= 100) {

    _root.mainarea.six.galleries[thumbnail]._visible = false;


    } else {
    _root.mainarea.six.galleries[thumbnail]._visible = true;


    }
    }

  10. #10
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    if (_root.mainarea.six.galleries[thumbnail].blank.bytesLoaded <= 100) {

    should be -

    if (_root.mainarea.six.galleries[thumbnail].blank.getBytesLoaded() <= 100) {

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