|
|
|
The kernel needs to set the "menu" property on the movieclip which has the image resource in it, I believe.
> The kernel needs to set the "menu" property on the movieclip which has the image resource in it, I believe.
Yes, this is my 'getMCRef'-movieclip. My only concerns are about what this movieclip 'can be'. Normally, we expect that it is a plain movieclip, but for non-proxied sound-loading, it is an instance of 'SoundMC', for example. Hey all,
FYI, this is a regression between 4.0.5.2 and 4.0.10. -Antun > FYI, this is a regression between 4.0.5.2 and 4.0.10.
Most likely due to the same reason as in I am looking at how to copy the menu from any existing movie clip to the clip which contains the resource.
I think this copy operation should happen after any new resource clip is loaded, so the menu, if it exists, is consistently present on the view even when the resource changes. I think at one point we had thought about having a special movie clip just to catch right menu clicks, that would be the only way to catch them if there is no resource and no movieclip for the bgcolor. Bleh, I see four references to this.__LZrightmenuclip in the LzSprite.as class, but it is never actually created by anyone.
The fix I sent out for review does not cover one case; if a new image is loaded via setSource, there is no code which automatically will copy the menu that was on the sprite's movieclips over to the new movieclip.
The user can work around that by manually calling setContextMenu when the onload event comes back from the image load, but we should have the media loader do this automatically. > The fix I sent out for review does not cover one case; if a new image is loaded via setSource, there is no code which automatically will copy
> the menu that was on the sprite's movieclips over to the new movieclip. Will you create a new changeset for that case? If you plan to do so, I'm not going to review the current change, instead I'll wait for next one. See
r8424 | hqm | 2008-03-26 11:01:54 -0400 (Wed, 26 Mar 2008) | 63 lines Changed paths: M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as Change 20080326-hqm-F by hqm@badtzmaru.local on 2008-03-26 10:42:53 EDT in /Users/hqm/openlaszlo/trunk4/WEB-INF/lps/lfc for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/lfc Summary: fix for context-menu bug on views with image resource New Features: Bugs Fixed: Technical Reviewer: max QA Reviewer: andre Doc Reviewer: (pending) Documentation: Release Notes: Details: + Made setContextMenu set the menu on the foreground movieclip if there is one + Made setResource copy the previous resource movieclip's menu to the new resource movieclip. If there was not a menu property on the foreground movieclip, try copying the menu property from the background-color movieclip. Tests: test case from bug report, right click over image area shows same menu as over background area. I used this test case, placed in the test/ directory, so as to access the resource in test/resources/gif/logo.gif <canvas> <view width="300" height="100" bgcolor="blue" resource="resources/gif/logo.gif"> <handler name="oninit"> var cm = new LzContextMenu(); cm.addItem(cm.makeMenuItem('new item 1')); cm.addItem(cm.makeMenuItem('new item 2')); setContextMenu(cm); </handler> <handler name="onclick"> this.setSource("resources/png/face.png"); </handler> </view> </canvas> Click right on image and background areas to verify that image and background have custom context menu Click left on view to load new resource Click right on image and background areas to verify that image and background have the custom context menu (pagan-deities branch build r8434 - mars rc/4.0.11)
This change is not in the pagan-deities branch. I thought it was a requirement for 4.0.11. Test 1:
<canvas> <view width="300" height="200" bgcolor="blue" resource="logo.gif"> <handler name="oninit"> var cm = new LzContextMenu(); cm.addItem(cm.makeMenuItem('new item 1')); cm.addItem(cm.makeMenuItem('new item 2')); setContextMenu(cm); </handler> </view> </canvas> Test 2: <canvas> <view width="300" height="200" bgcolor="blue" resource="logo.gif"> <handler name="oninit"> var cm = new LzContextMenu(); cm.addItem(cm.makeMenuItem('new item 1')); cm.addItem(cm.makeMenuItem('new item 2')); setContextMenu(cm); </handler> <handler name="onclick"> this.setSource("resources/png/face.png"); </handler> </view> </canvas> logo.gif: test/resources/gif/logo.gif or attached (pagan-deities branch build r8436 - mars rc/4.0.11)
Was missing png file. This working now. <canvas>
<view width="300" height="100" bgcolor="blue" resource="resources/gif/logo.gif"> <handler name="oninit"> var cm = new LzContextMenu(); cm.addItem(cm.makeMenuItem('new item 1')); cm.addItem(cm.makeMenuItem('new item 2')); setContextMenu(cm); </handler> <handler name="onclick"> this.setSource("resources/png/face.png"); </handler> </view> </canvas> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This attaches the menu to the image, so what do we need to update in the swf-kernel?
- LzSprite#setContextMenu(..):
set the menu to the '__LZbgRef' and to the 'getMCRef'-movieclip
- LzMakeLoadSprite.updateAfterLoad(..)
set the menu (if any) to the 'getMCRef'-movieclip
Needs some testing b/c loading image<>sound and proxied<>non-proxied is a bit different.