Hosting de Calidad
  • Inicio
  • Precios y servicios
  • F.a.q y ayudas
  • Realizar pedido
  • Webs alojadas
  • Quienes somos
  • Foro HyD
  • Contacto

    Zona Dominios

    Entrar
    registro de dominios


    Zona Hosting

    Entrar
    alojamiento web


    5 Métodos de Pago
    Tarjeta de crédito
    Domiciliación
    Transferencia
    Soporte Epagado
    Soporte Paypal

    Liberalización .es

    Ver mas
    dominios .es


  •  
     
     
    SWFAction

    SWFAction

    (PHP 4 >= 4_0_5)

    SWFAction __ Creates a new Action_

    Description

    new swfaction ( string script)

    Aviso

    Esta función es EXPERIMENTAL_ Esto significa que el comportamiento de esta función, el nombre de esta función y en definitiva TODO lo documentado sobre esta función, puede cambiar en una futura version de PHP SIN AVISO_ La advertencia queda hecha, y utilizar esta extensión queda bajo su propia responsabiliad_

    swfaction() creates a new Action, and compiles the given script into an SWFAction object_

    The script syntax is based on the C language, but with a lot taken out_ the SWF bytecode machine is just too simpleminded to do a lot of things we might like_ For instance, we can't implement function calls without a tremendous amount of hackery because the jump bytecode has a hardcoded offset value_ No pushing your calling address to the stack and returning_ every function would have to know exactly where to return to_

    So what's left? The compiler recognises the following tokens:

    • break

    • for

    • continue

    • if

    • else

    • do

    • while

    There is no typed data; all values in the SWF action machine are stored as strings_ The following functions can be used in expressions:

    time()

    Returns the number of milliseconds (?) elapsed since the movie started_

    random(seed)

    Returns a pseudo_random number in the range 0_seed_

    length(expr)

    Returns the length of the given expression_

    int(number)

    Returns the given number rounded down to the nearest integer_

    concat(expr, expr)

    Returns the concatenation of the given expressions_

    ord(expr)

    Returns the ASCII code for the given character

    chr(num)

    Returns the character for the given ASCII code

    substr(string, location, length)

    Returns the substring of length length at location location of the given string string_

    Additionally, the following commands may be used:

    duplicateClip(clip, name, depth)

    Duplicate the named movie clip (aka sprite)_ The new movie clip has name name and is at depth depth_

    removeClip(expr)

    Removes the named movie clip_

    trace(expr)

    Write the given expression to the trace log_ Doubtful that the browser plugin does anything with this_

    startDrag(target, lock, [left, top, right, bottom])

    Start dragging the movie clip target_ The lock argument indicates whether to lock the mouse (?)_ use 0 (FALSE) or 1 (TRUE)_ Optional parameters define a bounding area for the dragging_

    stopDrag()

    Stop dragging my heart around_ And this movie clip, too_

    callFrame(expr)

    Call the named frame as a function_

    getURL(url, target, [method])

    Load the given URL into the named target_ The target argument corresponds to HTML document targets (such as "_top" or "_blank")_ The optional method argument can be POST or GET if you want to submit variables back to the server_

    loadMovie(url, target)

    Load the given URL into the named target_ The target argument can be a frame name (I think), or one of the magical values "_level0" (replaces current movie) or "_level1" (loads new movie on top of current movie)_

    nextFrame()

    Go to the next frame_

    prevFrame()

    Go to the last (or, rather, previous) frame_

    play()

    Start playing the movie_

    stop()

    Stop playing the movie_

    toggleQuality()

    Toggle between high and low quality_

    stopSounds()

    Stop playing all sounds_

    gotoFrame(num)

    Go to frame number num_ Frame numbers start at 0_

    gotoFrame(name)

    Go to the frame named name_ Which does a lot of good, since I haven't added frame labels yet_

    setTarget(expr)

    Sets the context for action_ Or so they say_ I really have no idea what this does_

    And there's one weird extra thing_ The expression frameLoaded(num) can be used in if statements and while loops to check if the given frame number has been loaded yet_ Well, it's supposed to, anyway, but I've never tested it and I seriously doubt it actually works_ You can just use /:framesLoaded instead_

    Movie clips (all together now_ aka sprites) have properties_ You can read all of them (or can you?), you can set some of them, and here they are:

    • x

    • y

    • xScale

    • yScale

    • currentFrame _ (read_only)

    • totalFrames _ (read_only)

    • alpha _ transparency level

    • visible _ 1=on, 0=off (?)

    • width _ (read_only)

    • height _ (read_only)

    • rotation

    • target _ (read_only) (???)

    • framesLoaded _ (read_only)

    • name

    • dropTarget _ (read_only) (???)

    • url _ (read_only) (???)

    • highQuality _ 1=high, 0=low (?)

    • focusRect _ (???)

    • soundBufTime _ (???)

    So, setting a sprite's x position is as simple as /box_x = 100;_ Why the slash in front of the box, though? That's how flash keeps track of the sprites in the movie, just like a unix filesystem_ here it shows that box is at the top level_ If the sprite named box had another sprite named biff inside of it, you'd set its x position with /box/biff_x = 100;_ At least, I think so; correct me if I'm wrong here_

    This simple example will move the red square across the window_

    Ejemplo 1_ swfaction() example

    <?php
     $s = new SWFShape();
      $f = $s_>addFill(0xff, 0, 0);
      $s_>setRightFill($f);
    
      $s_>movePenTo(_500,_500);
      $s_>drawLineTo(500,_500);
      $s_>drawLineTo(500,500);
      $s_>drawLineTo(_500,500);
      $s_>drawLineTo(_500,_500);
    
      $p = new SWFSprite();
      $i = $p_>add($s);
      $i_>setDepth(1);
      $p_>nextFrame();
    
      for($n=0; $n<5; ++$n)
      {
        $i_>rotate(_15);
        $p_>nextFrame();
      }
    
      $m = new SWFMovie();
      $m_>setBackground(0xff, 0xff, 0xff);
      $m_>setDimension(6000,4000);
    
      $i = $m_>add($p);
      $i_>setDepth(1);
      $i_>moveTo(_500,2000);
      $i_>setName("box");
    
      $m_>add(new SWFAction("/box_x += 3;"));
      $m_>nextFrame();
      $m_>add(new SWFAction("gotoFrame(0); play();"));
      $m_>nextFrame();
    
      header('Content_type: application/x_shockwave_flash');
      $m_>output();
    ?>

    This simple example tracks down your mouse on the screen_

    Ejemplo 2_ swfaction() example

    <?php
    
      $m = new SWFMovie();
      $m_>setRate(36_0);
      $m_>setDimension(1200, 800);
      $m_>setBackground(0, 0, 0);
    
      /* mouse tracking sprite _ empty, but follows mouse so we can
         get its x and y coordinates */
    
      $i = $m_>add(new SWFSprite());
      $i_>setName('mouse');
    
      $m_>add(new SWFAction("
        startDrag('/mouse', 1); /* '1' means lock sprite to the mouse */
      "));
    
      /* might as well turn off antialiasing, since these are just squares_ */
    
      $m_>add(new SWFAction("
        this_quality = 0;
      "));
    
      /* morphing box */
      $r = new SWFMorph();
      $s = $r_>getShape1();
    
      /* Note this is backwards from normal shapes_  No idea why_ */
      $s_>setLeftFill($s_>addFill(0xff, 0xff, 0xff));
      $s_>movePenTo(_40, _40);
      $s_>drawLine(80, 0);
      $s_>drawLine(0, 80);
      $s_>drawLine(_80, 0);
      $s_>drawLine(0, _80);
    
      $s = $r_>getShape2();
    
      $s_>setLeftFill($s_>addFill(0x00, 0x00, 0x00));
      $s_>movePenTo(_1, _1);
      $s_>drawLine(2, 0);
      $s_>drawLine(0, 2);
      $s_>drawLine(_2, 0);
      $s_>drawLine(0, _2);
    
      /* sprite container for morphing box _
         this is just a timeline w/ the box morphing */
    
      $box = new SWFSprite();
      $box_>add(new SWFAction("
        stop();
      "));
      $i = $box_>add($r);
    
      for($n=0; $n<=20; ++$n)
      {
        $i_>setRatio($n/20);
        $box_>nextFrame();
      }
    
      /* this container sprite allows us to use the same action code many times */
    
      $cell = new SWFSprite();
      $i = $cell_>add($box);
      $i_>setName('box');
    
      $cell_>add(new SWFAction("
    
        setTarget('box');
    
        /* ___x means the x coordinate of the parent, i_e_ (__)_x */
        dx = (/mouse_x + random(6)_3 _ ___x)/5;
        dy = (/mouse_y + random(6)_3 _ ___y)/5;
        gotoFrame(int(dx*dx + dy*dy));
    
      "));
    
      $cell_>nextFrame();
      $cell_>add(new SWFAction("
    
        gotoFrame(0);
        play();
    
      "));
    
      $cell_>nextFrame();
    
      /* finally, add a bunch of the cells to the movie */
    
      for($x=0; $x<12; ++$x)
      {
        for($y=0; $y<8; ++$y)
        {
          $i = $m_>add($cell);
          $i_>moveTo(100*$x+50, 100*$y+50);
        }
      }
    
      $m_>nextFrame();
    
      $m_>add(new SWFAction("
    
        gotoFrame(1);
        play();
    
      "));
    
      header('Content_type: application/x_shockwave_flash');
      $m_>output();
    ?>

    Same as above, but with nice colored balls___

    Ejemplo 3_ swfaction() example

    <?php
    
      $m = new SWFMovie();
      $m_>setDimension(11000, 8000);
      $m_>setBackground(0x00, 0x00, 0x00);
    
      $m_>add(new SWFAction("
    
    this_quality = 0;
    /frames_visible = 0;
    startDrag('/mouse', 1);
    
      "));
    
      // mouse tracking sprite
      $t = new SWFSprite();
      $i = $m_>add($t);
      $i_>setName('mouse');
    
      $g = new SWFGradient();
      $g_>addEntry(0, 0xff, 0xff, 0xff, 0xff);
      $g_>addEntry(0_1, 0xff, 0xff, 0xff, 0xff);
      $g_>addEntry(0_5, 0xff, 0xff, 0xff, 0x5f);
      $g_>addEntry(1_0, 0xff, 0xff, 0xff, 0);
    
      // gradient shape thing
      $s = new SWFShape();
      $f = $s_>addFill($g, SWFFILL_RADIAL_GRADIENT);
      $f_>scaleTo(0_03);
      $s_>setRightFill($f);
      $s_>movePenTo(_600, _600);
      $s_>drawLine(1200, 0);
      $s_>drawLine(0, 1200);
      $s_>drawLine(_1200, 0);
      $s_>drawLine(0, _1200);
    
      // need to make this a sprite so we can multColor it
      $p = new SWFSprite();
      $p_>add($s);
      $p_>nextFrame();
    
      // put the shape in here, each frame a different color
      $q = new SWFSprite();
      $q_>add(new SWFAction("gotoFrame(random(7)+1); stop();"));
      $i = $q_>add($p);
    
      $i_>multColor(1_0, 1_0, 1_0);
      $q_>nextFrame();
      $i_>multColor(1_0, 0_5, 0_5);
      $q_>nextFrame();
      $i_>multColor(1_0, 0_75, 0_5);
      $q_>nextFrame();
      $i_>multColor(1_0, 1_0, 0_5);
      $q_>nextFrame();
      $i_>multColor(0_5, 1_0, 0_5);
      $q_>nextFrame();
      $i_>multColor(0_5, 0_5, 1_0);
      $q_>nextFrame();
      $i_>multColor(1_0, 0_5, 1_0);
      $q_>nextFrame();
    
      // finally, this one contains the action code
      $p = new SWFSprite();
      $i = $p_>add($q);
      $i_>setName('frames');
      $p_>add(new SWFAction("
    
    dx = (/:mousex_/:lastx)/3 + random(10)_5;
    dy = (/:mousey_/:lasty)/3;
    x = /:mousex;
    y = /:mousey;
    alpha = 100;
    
      "));
      $p_>nextFrame();
    
      $p_>add(new SWFAction("
    
    this_x = x;
    this_y = y;
    this_alpha = alpha;
    x += dx;
    y += dy;
    dy += 3;
    alpha _= 8;
    
      "));
      $p_>nextFrame();
    
      $p_>add(new SWFAction("prevFrame(); play();"));
      $p_>nextFrame();
    
      $i = $m_>add($p);
      $i_>setName('frames');
      $m_>nextFrame();
    
      $m_>add(new SWFAction("
    
    lastx = mousex;
    lasty = mousey;
    mousex = /mouse_x;
    mousey = /mouse_y;
    
    ++num;
    
    if(num == 11)
      num = 1;
    
    removeClip('char' & num);
    duplicateClip(/frames, 'char' & num, num);
    
      "));
    
      $m_>nextFrame();
      $m_>add(new SWFAction("prevFrame(); play();"));
    
      header('Content_type: application/x_shockwave_flash');
      $m_>output();
    ?>

    This simple example will handles keyboard actions_ (You'll probably have to click in the window to give it focus_ And you'll probably have to leave your mouse in the frame, too_ If you know how to give buttons focus programatically, feel free to share, won't you?)

    Ejemplo 4_ swfaction() example

    <?php
    
      /* sprite has one letter per frame */
    
      $p = new SWFSprite();
      $p_>add(new SWFAction("stop();"));
    
      $chars = "abcdefghijklmnopqrstuvwxyz"_
           "ABCDEFGHIJKLMNOPQRSTUVWXYZ"_
               "1234567890!@#$%^&/*()_+_=/[]{}|;:,_<>?`~";
    
      $f = new SWFFont("_sans");
    
      for($n=0; $nremove($i);
        $t = new SWFTextField();
        $t_>setFont($f);
        $t_>setHeight(240);
        $t_>setBounds(600,240);
        $t_>align(SWFTEXTFIELD_ALIGN_CENTER);
        $t_>addString($c);
        $i = $p_>add($t);
        $p_>labelFrame($c);
        $p_>nextFrame();
      }
    
      /* hit region for button _ the entire frame */
    
      $s = new SWFShape();
      $s_>setFillStyle0($s_>addSolidFill(0, 0, 0, 0));
      $s_>drawLine(600, 0);
      $s_>drawLine(0, 400);
      $s_>drawLine(_600, 0);
      $s_>drawLine(0, _400);
    
      /* button checks for pressed key, sends sprite to the right frame */
    
      $b = new SWFButton();
      $b_>addShape($s, SWFBUTTON_HIT);
    
      for($n=0; $naddAction(new SWFAction("
    
    setTarget('/char');
    gotoFrame('$c');
    
        "), SWFBUTTON_KEYPRESS($c));
      }
    
      $m = new SWFMovie();
      $m_>setDimension(600,400);
      $i = $m_>add($p);
      $i_>setName('char');
      $i_>moveTo(0,80);
    
      $m_>add($b);
    
      header('Content_type: application/x_shockwave_flash');
      $m_>output();
    
    ?>

     
       



    registro de dominios | alojamiento web | hosting por publicidad

       

     

    Manual de linux Manual de apache Manual de php Manual de mysql Manual de SQL Manual del Plesk Como funciona Paypal Manual de html