Stage.properties

  • Started
  • Last post
  • 5 Responses
  • jpea

    anyone know of any way to keep track of tons of things on stage that need to be aligned and moved on resize?

    right now, i have a listener calling a function, and damn, that function is growing like 50 lines long of mc._x = Stage.width-30 and such statements

    this project's becoming the biggest headache i've ever had just because of the need for everything to be proportional and aligned to other things on the stage on resize

    ugh.
    *clubs head in frustration

  • Mimio0

    Are they all the same object class?

  • Anarchitect0

    [answering with some questions]

    are they triggered by the Stage listener or some other object?

    are they supposed to be aligned all at once or some conditionals should be created to filter specifics objects for alignment?

    some objects could be aligned in the exact same way so expressions obj1._x = obj2._x = obj3._x = x might come handy and reduce the code.

    specific object 'conditioning' can use "?:" to reduce the expression size to 1/5 of the size:

    obj._x = (expression)? value1: value2;

    _______

  • jpea0

    stage listener, and they don't all go to the same place. and most of the stuff is dynamically loaded from a database (text, image, vid).

    ie: nav goes bottom right-20px, center loaded project, but then yscale something and move it to the very right, etc... that's the simple version

    basically, it's gotta be able to load tons of different data types, center, left, centermiddle, etc align all of them to wherever they need to be

    i was just curious if, there was a simpler way to think about how to do it.. kind of a 'best practices' question (besides the "You shouldn't have accepted the project" response)

  • Anarchitect0

    the best practice is to check for patterns within the desired behaviour.

    you probably can separate the "groups of alignments" in 3/4 functions/conditions.

    some of them can be used from Stage listeners, others from other listeners, like those used with MovieClipLoaders...

    you also might also want to add _root variables that can be updated/used without having to using the same expression over and over for the same value.

    look to your code. try to decrease the number of lines by grouping similar expressions or reducing conditionals.

    the keyword is patterns.

  • jpea0

    thanks for the advice :)
    i think i'm going to go through a rethinking of some of the code and where it resides and what it pulls in and such.. hopefully make this sucker leaner

    thanks :)