Author: max
Date: 2007-10-19 14:42:57 -0700 (Fri, 19 Oct 2007)
New Revision: 6929
Added:
openlaszlo/trunk/test/lfc/legals/music.mp3
openlaszlo/trunk/test/lfc/legals/resc/logo.swf
openlaszlo/trunk/test/lfc/legals/resc/wallpaper-thumb.jpg
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTrack.lzs
openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
openlaszlo/trunk/test/lfc/legals/multiframeresource.lzx
Log:
Change 20071018-maxcarlson-X by [EMAIL PROTECTED] on 2007-10-18 19:16:37 PDT
in /Users/maxcarlson/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Enhance dhtml event mouse and media event support
New Features: DHTML support for onmousedragin, onmousedragout,
onmouseupoutside, onplay, onstop, onframe and onlastframe events.
Bugs Fixed: LPP-3730 - A number of events don't currently work for views with
multi-frame resources.
Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details: Add resources for testing.
multiframeresource.lzx - updated testcase to test mouse and media load events
across runtimes
LzSprite.js - Add callbacks for onmousedragin, onmousedragout,
onmouseupoutside, onplay, onstop, onframe and onlastframe events
LzTrack.lzs - Update doc comment to events that exist
LaszloView.lzs - Remove unused onaddsubresource event. Add resourceevent()
callback to receive media events from sprites.
Tests: run test/lfc/legals/multiframeresource across swf7 and 8, dhtml proxied
and non. Most events should now fire.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2007-10-19
18:46:42 UTC (rev 6928)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js 2007-10-19
21:42:57 UTC (rev 6929)
@@ -673,7 +673,17 @@
}
//Debug.write('__mouseEvent', eventname, this.owner);
- if (skipevent == false && this.owner.mouseevent && LzModeManager &&
LzModeManager['handleMouseButton']) LzModeManager.handleMouseButton(this.owner,
eventname);
+ if (skipevent == false && this.owner.mouseevent && LzModeManager &&
LzModeManager['handleMouseButton']) {
+ LzModeManager.handleMouseButton(this.owner, eventname);
+
+ if (this.__mousedown) {
+ if (eventname == 'onmouseover') {
+ LzModeManager.handleMouseButton(this.owner, 'onmousedragin');
+ } else if (eventname == 'onmouseout') {
+ LzModeManager.handleMouseButton(this.owner, 'onmousedragout');
+ }
+ }
+ }
}
// called by LzMouseKernel when mouse goes up on another sprite
@@ -683,6 +693,7 @@
LzSprite.prototype.__globalmouseup = function ( e ){
if (this.__mousedown) {
this.__mouseEvent(e);
+ this.__mouseEvent({type: 'mouseupoutside'});
}
}
@@ -845,6 +856,7 @@
if (this.frames && this.frames.length > 1) {
this.playing = true;
+ this.owner.resourceevent('play', null, true);
LzIdleKernel.addCallback(this, '__incrementFrame');
}
}
@@ -852,6 +864,7 @@
LzSprite.prototype.stop = function(f) {
if (this.playing == true) {
this.playing = false;
+ this.owner.resourceevent('stop', null, true);
LzIdleKernel.removeCallback(this, '__incrementFrame');
}
@@ -879,10 +892,12 @@
LzSprite.prototype.__updateFrame = function(force) {
if (this.playing || force) {
var url = this.frames[this.frame - 1];
- //Debug.info('__updateFrame', this.frame, url);
+ //Debug.info('__updateFrame', this.frame, url, this.owner);
this.setSource(url, true);
}
- if (this.owner.frame != this.frame - 1)
this.owner.spriteAttribute('frame', this.frame);
+ this.owner.resourceevent('frame', this.frame);
+ if (this.frames.length == this.frame)
+ this.owner.resourceevent('lastframe', null, true);
}
if (LzSprite.prototype.quirks.preload_images_only_once) {
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTrack.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTrack.lzs 2007-10-19
18:46:42 UTC (rev 6928)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzTrack.lzs 2007-10-19
21:42:57 UTC (rev 6929)
@@ -12,8 +12,8 @@
/**
* <p>This service helps tracking the mouse over a number of views, as in
* common when implementing menus and drag-and-drop behaviors. When the
- * mouse is down, standard view events such as <event>ondragin</event>
- * and <event>ondragout</event> are only sent to the view which received
+ * mouse is down, standard view events such as <event>onmousedragin</event>
+ * and <event>onmousedragout</event> are only sent to the view which received
* the onmousedown events. When views are registered using the
* <classname>LzTrack</classname> service, they will receive events
* independent of the mouse button state.
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-10-19
18:46:42 UTC (rev 6928)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/views/LaszloView.lzs 2007-10-19
21:42:57 UTC (rev 6929)
@@ -76,7 +76,6 @@
*/
static var tagname = 'view';
-DeclareEvent(prototype, 'onaddsubresource' );
/** Event called when this view adds a subview */
DeclareEvent(prototype, 'onaddsubview' );
DeclareEvent(prototype, 'onbgcolor' );
@@ -995,6 +994,16 @@
}
/**
+ * @access private
+ * Called by the sprite when the resource playback events occur
+ */
+function resourceevent(name, value, eventonly) {
+ if (eventonly != true) this[name] = value;
+ var ev = this['on'+ name];
+ if (ev.ready) ev.sendEvent(value);
+}
+
+/**
* This method is called to set the number of total frames in the resource.
* The ontotalframes event is generated
*
Modified: openlaszlo/trunk/test/lfc/legals/multiframeresource.lzx
===================================================================
--- openlaszlo/trunk/test/lfc/legals/multiframeresource.lzx 2007-10-19
18:46:42 UTC (rev 6928)
+++ openlaszlo/trunk/test/lfc/legals/multiframeresource.lzx 2007-10-19
21:42:57 UTC (rev 6929)
@@ -1,18 +1,76 @@
<!--
/* X_LZ_COPYRIGHT_BEGIN ***************************************************
-* Copyright 2001-2006 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* X_LZ_COPYRIGHT_END ******************************************************/
-->
-<canvas width="100%" height="80%">
+<canvas width="100%" height="400">
<resource name="tabrsrc" >
+ <frame src="resc/h_c_web2con.gif" />
<frame src="resc/wallpaper.jpg" />
- <frame src="resc/h_c_web2con.gif" />
</resource>
<resource name="logoanim" src="animation/"/>
- <view name="foo" resource="tabrsrc" onmousedown="this.play()"
onmouseup="this.stop()"/>
+ <class name="eventtester" width="150">
+ <attribute name="eventname" value="" type="text"/>
+ <handler name="oninit">
+ if (eventname == '') Debug.warn('Must specify event name.')
+ this.evDel = new LzDelegate(this, 'update', parent, eventname);
+ </handler>
+ <method name="update" args="d">
+ this.txt.setText(eventname + ': '+ d);
+ this.bg.setBGColor(green);
+ </method>
- <view name="bar" resource="logoanim" x="300" oninit="this.play()"/>
+ <view name="bg" bgcolor="red" opacity=".5" width="100%" height="100%"/>
+ <text name="txt" text="${classroot.eventname}" width="150"/>
+ </class>
+
+ <view name="foo" resource="tabrsrc" onmousedown="this.play()"
onmouseup="this.stop()" options="ignorelayout"/>
+
+ <class name="statusloader" width="150">
+ <attribute name="label" value="" type="text"/>
+ <handler name="onlastframe">
+ this.stop();
+ </handler>
+ <handler name="onvisible">
+ this.setVisible(true);
+ </handler>
+
+ <simplelayout/>
+ <text text="${classroot.label}"/>
+ <eventtester eventname="onframe"/>
+ <eventtester eventname="ontotalframes"/>
+ <eventtester eventname="onlastframe"/>
+ <eventtester eventname="onplay"/>
+ <eventtester eventname="onstop"/>
+ <eventtester eventname="onload"/>
+ <eventtester eventname="onloadperc"/>
+ <eventtester eventname="onerror"/>
+ <eventtester eventname="ontimeout"/>
+ </class>
+
+ <simplelayout axis="x" inset="200"/>
+
+ <view name="mousetester" clickable="true">
+ <simplelayout/>
+ <text text="mouse events turn green"/>
+ <eventtester eventname="onmouseover"/>
+ <eventtester eventname="onmouseout"/>
+ <eventtester eventname="onmousedown"/>
+ <eventtester eventname="onmouseup"/>
+ <eventtester eventname="onclick"/>
+ <eventtester eventname="ondblclick"/>
+ <eventtester eventname="onmousedragin"/>
+ <eventtester eventname="onmousedragout"/>
+ <eventtester eventname="onmouseupoutside"/>
+ </view>
+
+ <statusloader resource="logoanim" label="local resource"
onclick="this.play()"/>
+ <statusloader resource="logoanim" play="true" label="local resource play"
onclick="this.play()"/>
+ <statusloader oninit="this.setSource('resc/wallpaper-thumb.jpg')"
label="single frame"/>
+ <statusloader oninit="this.setSource('resc/logo.swf')" label="swf only
multiframe" onclick="this.play()"/>
+ <statusloader resource="http:music.mp3" label="swf only mp3 audio"
onclick="this.play()"/>
+ <statusloader oninit="this.setSource('bad.bar')" label="should fail"/>
</canvas>
Added: openlaszlo/trunk/test/lfc/legals/music.mp3
Property changes on: openlaszlo/trunk/test/lfc/legals/music.mp3
___________________________________________________________________
Name: svn:mime-type
+ audio/mpeg3
Added: openlaszlo/trunk/test/lfc/legals/resc/logo.swf
Property changes on: openlaszlo/trunk/test/lfc/legals/resc/logo.swf
___________________________________________________________________
Name: svn:mime-type
+ application/x-shockwave-flash
Added: openlaszlo/trunk/test/lfc/legals/resc/wallpaper-thumb.jpg
Property changes on: openlaszlo/trunk/test/lfc/legals/resc/wallpaper-thumb.jpg
___________________________________________________________________
Name: svn:mime-type
+ image/jpeg
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins