dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: whats wrong with this simple function?

  1. #1
    Senior Member
    Join Date
    May 2005
    Posts
    324

    whats wrong with this simple function?

    using this code to look for instances around a depth

    Code:
    function systemHalt() {
    	for (i=300; i>=401; i++) {
    		item = _root.getInstanceAtDepth(i);
    		trace (item)
    	}
    }
    with this
    Code:
    onEnterFrame = function () {
    	systemHalt()
    }
    to call it, but all it returns is undefined, once. not continously as you would expect

    where is going wrong?
    "great scott!"

    "I know, this is heavy!"

  2. #2
    for (i=300; i>=401; i++) {

    try i<=401

    FuzzGtp

  3. #3
    hmm.. having problems getting this to work on root ><
    FuzzGtp

  4. #4
    Senior Member
    Join Date
    May 2005
    Posts
    324
    always something stupid!!!

    annoying, cuz i'm quite new and i always immediatley doubt my scripting, always over look minor mathematics
    "great scott!"

    "I know, this is heavy!"

  5. #5
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    just out of curiousity what are you needing that for? I been thinking about it and while I didnt know about getInstanceAtDepth(n) and it sounds cool I cant think of a reason Id need to use it...

  6. #6
    Senior Member
    Join Date
    May 2005
    Posts
    324
    basically, i am making a little kind of beat machine, but it churns out CPU, so i want the main features to halt whenever certain things are loaded. as there a quite a few thinks that do this, i thought the simplist way to determine if or not any of them are laoded was to scan the range of depths i know they all lie in between, then use

    if (!systemHalt) {
    //
    }

    to restrict use to times when allowed
    "great scott!"

    "I know, this is heavy!"

  7. #7
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    ahh that makes sense...sort of...why wouldnt you have the thing set a flag when it pops up instead though...might be more efficient

  8. #8
    Senior Member
    Join Date
    May 2005
    Posts
    324
    how do you do that?
    "great scott!"

    "I know, this is heavy!"

  9. #9
    Senior Member
    Join Date
    Apr 2006
    Posts
    1,059
    well it depends on how the element pops up...If you have the user push a button just add(to onMouseUp) systemhalt = true
    and then when your done with our intese operations
    systemhalt = false

    then just check that variable before doing your complex stuff if its true then halt the system before doin yer thing

    if its false then dont bother halting the system when you do yer hardcore CPU cranking..

    if its a dynamic thing

    right before you pop up whatever dynamic opbject with your

    popUpComponent(this) or however you do it just check if
    this == "IntensehardCoreObject_tohaltsystem"

    if your having to halt the system due to CPU clocking...you may want to look further at your code...cause that usually wouldnt be necessary

    if you wanna post yer FLA and exactly what your trying to do I can prolly show you exactly(if your still having a tough time)

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