4 Replies Latest reply on Feb 17, 2011 10:37 PM by drom_techmarine

    Property Resets to Zero?

    bmberkowitz2010

      I have a set of handlers in a behavior that takes a number input from a field and dynamically scales a 3D sphere model.  However, the variable that holds the previous radius of the sphere (pPreviousRad) keeps resetting to zero, which screws everything up.  Does anyone know why that might be?  Here is the part of my code:

       

       

       

      global gIsActive

      property pSprite

      property pMember

      property pModel

      property pRadius

      property pPreviousRad

       

       

      on enterFrame me

        if gIsActive = TRUE then

          radiusActive()

        end if

      end

       

       

      on radiusActive()

        if NOT(value(member("Size Field").text) = pPreviousRad) AND NOT(member("Size Field").text="") then

          prevRad = pPreviousRad

          newRad = modifyRadius(prevRad)

          pPreviousRad = newRad

        end if

      end

       

       

      on modifyRadius(prevRad)

        if prevRad > 0 then

          scaleFactor = (value(member("Size Field").text))/(10*prevRad)

          pModel.scale(scaleFactor, scaleFactor, scaleFactor)

        end if

       

        returnRad = value(member("Size Field").text)/10

        return returnRad

      end