php-doc-en/reference/ming/swfaction.xml
Pierrick Charron 4724b47c25 Added new entities for Properties, Methods, InheritedMethods, Constants
# Those words were hardcoded in all class synopsis 


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@292734 c90b9560-bf6c-de11-be94-00142212c4b1
2009-12-29 09:42:00 +00:00

454 lines
12 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xmlns:phpdoc="http://php.net/ns/phpdoc" xml:id="class.swfaction" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The SWFAction class</title>
<titleabbrev>SWFAction</titleabbrev>
<partintro>
<!-- {{{ SWFAction intro -->
<section xml:id="swfaction.intro">
&reftitle.intro;
<para>
SWFAction.
</para>
</section>
<!-- }}} -->
<section xml:id="swfaction.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>SWFAction</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>SWFAction</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.swfaction')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<section>
&reftitle.description;
<para>
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.
</para>
<para>
So what's left? The compiler recognises the following tokens:
<itemizedlist>
<listitem>
<simpara>
break
</simpara>
</listitem>
<listitem>
<simpara>
for
</simpara>
</listitem>
<listitem>
<simpara>
continue
</simpara>
</listitem>
<listitem>
<simpara>
if
</simpara>
</listitem>
<listitem>
<simpara>
else
</simpara>
</listitem>
<listitem>
<simpara>
do
</simpara>
</listitem>
<listitem>
<simpara>
while
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
There is no typed data; all values in the SWF action machine are stored as strings.
The following functions can be used in expressions:
<variablelist>
<varlistentry>
<term>time()</term>
<listitem>
<simpara>
Returns the number of milliseconds (?) elapsed since the movie started.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>random(seed)</term>
<listitem>
<simpara>
Returns a pseudo-random number in the range 0-seed.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>length(expr)</term>
<listitem>
<simpara>
Returns the length of the given expression.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>int(number)</term>
<listitem>
<simpara>
Returns the given number rounded down to the nearest integer.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>concat(expr, expr)</term>
<listitem>
<simpara>
Returns the concatenation of the given expressions.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>ord(expr)</term>
<listitem>
<simpara>
Returns the ASCII code for the given character
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>chr(num)</term>
<listitem>
<simpara>
Returns the character for the given ASCII code
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>substr(string, location, length)</term>
<listitem>
<simpara>
Returns the substring of length <parameter>length</parameter> at location <parameter>location</parameter> of
the given string <parameter>string</parameter>.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
Additionally, the following commands may be used:
<variablelist>
<varlistentry>
<term>duplicateClip(clip, name, depth)</term>
<listitem>
<simpara>
Duplicate the named movie <parameter>clip</parameter> (aka sprite). The new movie clip has name <parameter>name</parameter>
and is at depth <parameter>depth</parameter>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>removeClip(expr)</term>
<listitem>
<simpara>
Removes the named movie clip.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>trace(expr)</term>
<listitem>
<simpara>
Write the given expression to the trace log. Doubtful that the browser
plugin does anything with this.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>startDrag(target, lock, [left, top, right, bottom])</term>
<listitem>
<simpara>
Start dragging the movie clip <parameter>target</parameter>. The <parameter>lock</parameter> argument indicates whether
to lock the mouse (?)- use 0 (&false;) or 1 (&true;). Optional parameters
define a bounding area for the dragging.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>stopDrag()</term>
<listitem>
<simpara>
Stop dragging my heart around. And this movie clip, too.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>callFrame(expr)</term>
<listitem>
<simpara>
Call the named frame as a function.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>getURL(url, target, [method])</term>
<listitem>
<simpara>
Load the given URL into the named target. The <parameter>target</parameter> argument
corresponds to HTML document targets (such as "_top" or "_blank").
The optional <parameter>method</parameter> argument can be POST or GET if you want to submit
variables back to the server.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>loadMovie(url, target)</term>
<listitem>
<simpara>
Load the given URL into the named target. The <parameter>target</parameter> 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).
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>nextFrame()</term>
<listitem>
<simpara>
Go to the next frame.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>prevFrame()</term>
<listitem>
<simpara>
Go to the last (or, rather, previous) frame.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>play()</term>
<listitem>
<simpara>
Start playing the movie.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>stop()</term>
<listitem>
<simpara>
Stop playing the movie.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>toggleQuality()</term>
<listitem>
<simpara>
Toggle between high and low quality.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>stopSounds()</term>
<listitem>
<simpara>
Stop playing all sounds.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>gotoFrame(num)</term>
<listitem>
<simpara>
Go to frame number <parameter>num</parameter>. Frame numbers start at 0.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>gotoFrame(name)</term>
<listitem>
<simpara>
Go to the frame named <parameter>name</parameter>. Which does a lot of good, since I
haven't added frame labels yet.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>setTarget(expr)</term>
<listitem>
<simpara>
Sets the context for action. Or so they say- I really have no
idea what this does.
</simpara>
</listitem>
</varlistentry>
</variablelist>
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.
</para>
<para>
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:
<itemizedlist>
<listitem>
<simpara>
x
</simpara>
</listitem>
<listitem>
<simpara>
y
</simpara>
</listitem>
<listitem>
<simpara>
xScale
</simpara>
</listitem>
<listitem>
<simpara>
yScale
</simpara>
</listitem>
<listitem>
<simpara>
currentFrame - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
totalFrames - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
alpha - transparency level
</simpara>
</listitem>
<listitem>
<simpara>
visible - 1=on, 0=off (?)
</simpara>
</listitem>
<listitem>
<simpara>
width - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
height - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
rotation
</simpara>
</listitem>
<listitem>
<simpara>
target - (read-only) (???)
</simpara>
</listitem>
<listitem>
<simpara>
framesLoaded - (read-only)
</simpara>
</listitem>
<listitem>
<simpara>
name
</simpara>
</listitem>
<listitem>
<simpara>
dropTarget - (read-only) (???)
</simpara>
</listitem>
<listitem>
<simpara>
url - (read-only) (???)
</simpara>
</listitem>
<listitem>
<simpara>
highQuality - 1=high, 0=low (?)
</simpara>
</listitem>
<listitem>
<simpara>
focusRect - (???)
</simpara>
</listitem>
<listitem>
<simpara>
soundBufTime - (???)
</simpara>
</listitem>
</itemizedlist>
So, setting a sprite's x position is as simple as <literal>/box.x = 100;</literal>.
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.
</para>
</section>
</partintro>
&reference.ming.entities.swfaction;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->