• well it's been a year so i should make another attempt.
    I am still somewhat confused about the "placeholder" where they are defined and used.

    if I type

    find ./ -type f -exec grep sometext $1 {} \;
    I understand that the $1 gets replace in the iteration by the current found file.

    I understand a variable can "contain" different values in the running of code.
    but I am sometimes confused reading code examples where I do not know if the "variable", "placeholder" is supposed to be entered by me in my own instance of the code or if it is a shorthand for writing somehow or it is an actual variable in memory that will go there when the code is run.

    I imagine that in
    action (%0, %1, %2, %3) the "variable %1 (which is "initialed" elsewhere) now contains the value of 123 after
    action (fish, 123, someotherthing, somethingelse)
    and if i later use the expression %1 with (fish,%1) it is replaced with 123 ( fish,123)
    so a year ago I asked if %u %v %x, %h etc could be any letter but didn't recieve any answer. I assume now that they are "initialed" somewhere in the .swf file.
    I would like though an explanation of what exactly is the placeholder in terms I can easily understand.

    regards

    mick

  • Hi,

    there are currently 3 different types of placeholders,

    • %h,%u,%v, %x,%y, %r,%c, %g - are placeholders for the tile index for multiresolution images,
      they can only be used in tiled or multiresolution image urls,
      this placesholders will be resolved while loading
    • then there are placeholders for paths - %SWFPATH%, %HTMLPATH%, %CURRENTXML% and %FIRSTXML%,
      they can only be used in paths / "url" variables,
      this placesholders will be also resolved while loading
    • then the %0, %1, %2, ... placesholders,
      this are placesholders for actions arguments,
      %0 = name of the action itself
      %1 = first argument
      %2 = second argument
      ...
      they can only be used INSIDE the called action,

    best regards,
    Klaus

  • hi,
    thanks, is it possible you could expand on the action placeholders explanation with more examples.
    I think it is the one block.
    I might understand that
    action(name, thing, anotherthing, something) is like an array called "name" like name(1,1,1)
    the placeholder is only relevant to the "named" action.

    In your examples there is

    <action name="fadein">
    set(plugin[%1].visible,true);
    tween(plugin[%1].alpha,1);
    </action>

    could you put that in context ? where the placeholder %1 is declared. how it is used ?

    regards

    mick

  • Hi,

    here an example:

    the action:

    Code
    <action name="example">
      trace('the name of the action is: %0');
      trace('the first argument: %1');
      trace('the second argument: %2');
      trace('the third argument: %3');
    </action>


    now there two ways to call this action:

    1. action(name-of-the-action, arguments...);
    e.g.

    Code
    ...onclick="action(example, abc, 123, xyz);"

    2. or since 1.0.8 beta 8 - direct, without "action()" = name-of-the-action(arguments...);

    Code
    ...onclick="example(abc, 123, xyz);"


    internally it works like this:

    1. the CONTENT of the called action is loaded as string
      (<action>THIS-IS-THE-CONTENT</action>)
    2. then the %0, %1, %2, ... placeholders are REPLACED with the given arguments
      e.g. this:

      Code
      trace('the name of the action is: %0');
      trace('the first argument: %1');
      trace('the second argument: %2');
      trace('the third argument: %3');


      will become this:

      Code
      trace('the name of the action is: example');
      trace('the first argument: abc');
      trace('the second argument: 123');
      trace('the third argument: xyz');
    3. then these actions are parsed and executed


    to pass the CONTENT of variables to an action - get(var) - can be used (also since 1.0.8 beta 8)
    get(var) can currently only be used inside arguments (for any action)

    e.g.

    Code
    ...onclick="example(get(view.hlookat), get(view.vlookat), get(view.fov));"

    this will become in the first step: (example values)

    Code
    ...onclick="example(100.123, 5.253, 90.0);"


    and then in the next step the action will be called with these values,


    best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!