dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: this should be simple

  1. #1
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    is it possible to do something like - which i would expect to work

    Code:
    if (_level == _level0){
    trace("this is the base movie")
    }
    i would think it would work but when this code is added to a movie (lets say on level2 i still get a trace out)

    Code:
    if (_level.toString() == "_level0"){
    trace("this is the base movie")
    }
    the above does not work nor does

    Code:
    if (_level == "_level0"){
    trace("this is the base movie")
    }
    is there a way i have overlooked?

    thanks

  2. #2
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    try this:
    Code:
    if (this == "_level0") {
        trace("wow");
    }
    when you make flash retrieve the "this" variable, it returns a string describing the path, whereas "this._name" returns the label of the mc you runned the script in.

    hope this helps!

  3. #3
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    nope - that don't work either!

    thanks anyway

  4. #4
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    try this instead:

    Code:
    if(_root == _level0)
        trace("wow!");
    This works just fine for me!

    /Mirandir

  5. #5
    Senior Member
    Join Date
    Apr 2001
    Posts
    207

    Smile xcuse me

    please xcuse my ignorance, im new to flash actionscript, but whats the TRACE action for?

  6. #6
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    trace actions are for movie testing.
    if you put
    Code:
    trace ("hello");
    when you test your movie (Ctrl + Enter), a window, called "output", will show the message you entered...which is "hello".

    This is very usefull when you are trying to find the darn bug that is stopping your scripts from working...
    you just place a couple of trace commands here and there to check were the variables you are using get lost, or wether an if instruction works or not....

  7. #7
    the usual
    Join Date
    Jul 2000
    Posts
    1,482
    leonardourich:

    the trace() function is a debugging tool used only within the test movie mode of flash. it allows us to check the value of a variable or expression at any point during the playback of the movie.

    in this case we used the trace function to check if

    Code:
    if(_root == _level0){
    and if it did.does then "wow!" would be displayed in the output window in flash

    hth

    Mirandir:

    thats just about the only one i tried - thanks for the help!

    however - do you know why the others don't work? - i would have thought that

    Code:
    if (_level == _level0){
    would have worked

    thanks again everyone!

  8. #8
    Senile member! :)
    Join Date
    Dec 2001
    Location
    Saunaswamp (transl)
    Posts
    2,296
    trace

    trace is a function that is used for debugging purposes only since it has no effect outside the flash authoring enviorment AFAIK.

    What it does is that it simply writes the argument into the output panel when you preview the movie in flash.

    here is a simple example:
    start a new movie. click on the single frame in the timeline. go to the actionspanel and enter this:

    Code:
    trace("Hello world!");
    if you are using normal mode you can find it in actions -> miscallenius actions
    then go to to the menu file->publish preview->flash.

    notice that a panel called output opens and the text Hello world! is displayed.

    /Mirandir

  9. #9
    Senior Member
    Join Date
    Apr 2001
    Posts
    207

    Smile hey thank you

    THNAK YOU VERY MUCH GUYS FOR YOUR FEEDBACK. YOURE THE "BEST". hahahahaha i thought it was for making a tracebitmap in a picture. hahahahah im so idiot, hahahahahhahahahahaha. thank you again guys. hahaha

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