History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-5670
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: P0 P0
Assignee: Unassigned
Reporter: Henry Minsky
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Context-menu will not be preserved on view's image resource when setSource() is called

Created: 26/Mar/08 06:17 AM   Updated: 25/Dec/08 09:51 AM
Component/s: Kernel - swf6-8
Affects Version/s: RingDing (4.1)
Fix Version/s: Dunkin (4.2b3)

Time Tracking:
Not Specified

File Attachments: 1. File lpp-5670.tar (10 kb)
2. File lpp-5670__UPDATE.lzx (5 kb)

Image Attachments:

1. 5670dhtml-003.jpg
(88 kb)

2. 5670dhtml-2.jpg
(88 kb)

3. 5670swf-2.jpg
(94 kb)

Severity: Minor
Fixed in Change#: 11,441
Fixed in branch: trunk
Runtime: N/A
Fix in hand: False


 Description  « Hide
This is a followup to LPP-5636. The issue is that when setSource() is called on a view, and a new image resource
is loaded, the context-menu value from the previous resource movieclip needs to be copied to the 'menu' property of the new image movieclip.

This will need to be done in the onload handler for the media loader. I think we need to store an instance var on the
view which holds a copy of the currently active Flash ContextMenu object,as set by the last call to setContextMenu,
and set that menu on any newly applied foreground and/or background color movieclips.


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Henry Minsky - 26/Mar/08 07:04 AM
checked in as r8424 (review still pending though)

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: LPP-5636, LPP-5670

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





Amy Muntz - 26/Mar/08 07:31 AM
Please merge to pagan-deities (same changeset as LPP-5636.)

Henry Minsky - 26/Mar/08 10:19 AM
merged to pagan deities

Henry Minsky - 26/Mar/08 01:54 PM
Comments from Andre:
In the following testcase, not all images receive properly the view's
contextmenu.

@Max:
Why do I need to make that view visible again, mysteriously it's
visible-property is set to "false"!?
<view width="250" height="60"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
   oninit="canvas.makeContextMenu(this); this.setBGColor(red);"
   onload="this.setResource('http:LPP-5636.png');this.setVisible(true);" />

---
<canvas debug="true" oninit="canvas.makeContextMenu(this)" >

   <resource name="rsc" src="LPP-5636.png" />

   <attribute name="httprsc"
value="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
type="string" />
   <attribute name="ctxmenu_uid" value="0" type="number" />

   <simplelayout axis="x" spacing="10" />

   <method name="makeContextMenu" args="who" >
       var cm = new LzContextMenu();
       cm.addItem(cm.makeMenuItem(who.constructor.tagname + ' ' +
(canvas.ctxmenu_uid++)));
       who.setContextMenu(cm);
   </method>

   <view>
       <simplelayout axis="y" spacing="10" />
       <text>normal views</text>

       <view width="250" height="60"
oninit="canvas.makeContextMenu(this)" />
       <view width="250" height="60"
oninit="canvas.makeContextMenu(this); this.setBGColor(red);" />
       <view width="250" height="60" bgcolor="yellow"
oninit="canvas.makeContextMenu(this);" />
       <view width="250" height="60" bgcolor="yellow"
oninit="canvas.makeContextMenu(this); this.setBGColor(red);" />
   </view>

   <view>
       <simplelayout axis="y" spacing="10" />
       <text>views with resources</text>

       <view width="250" height="60"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
           oninit="canvas.makeContextMenu(this)" />

       <view width="250" height="60" bgcolor="blue"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
           oninit="canvas.makeContextMenu(this)" />

       <view width="250" height="60"
               resource="rsc"
               oninit="canvas.makeContextMenu(this)" />

       <view width="250" height="60" bgcolor="blue"
               resource="rsc"
               oninit="canvas.makeContextMenu(this)" />

       <view width="250" height="60"
               resource="rsc"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(red);" />

       <view width="250" height="60" bgcolor="blue"
               resource="rsc"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(red);" />

       <!-- these do not work -->
       <!--
       <view width="250" height="60" bgcolor="blue"
               resource="rsc"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(red); /*this.setResource(canvas.httprsc);*/" />

       <view width="250" height="60"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(yellow); this.setResource('rsc');
               Debug.write('%w - %d x %d', this, this.x, this.y);" />

       <view width="250" height="60" bgcolor="blue"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(yellow); this.setResource('rsc');
               Debug.write('%w - %d x %d', this, this.x, this.y);" />
       -->

       *<!-- no context menu on the image for the following four views -->
       <view width="250" height="60"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(yellow);"
               onload="this.setResource('rsc');" />

       <view width="250" height="60" bgcolor="blue"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
               oninit="canvas.makeContextMenu(this);
this.setBGColor(yellow);"
               onload="this.setResource('rsc');" />

       <!-- mysteriously these get invisible -->
       <view width="250" height="60"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
               oninit="canvas.makeContextMenu(this); this.setBGColor(red);"

onload="this.setResource('http:LPP-5636.png');this.setVisible(true);" />

       <view width="250" height="60" bgcolor="blue"

resource="http://www.openlaszlo.org/themes/manji/images/ol_logo_small.gif"
               oninit="canvas.makeContextMenu(this); this.setBGColor(red);"

onload="this.setResource('http:LPP-5636.png');this.setVisible(true);" />*
   </view>

   <view>
       <simplelayout axis="y" spacing="10" />
       <text>texts</text>

       <text text="contextmenu" oninit="canvas.makeContextMenu(this)" />
       <text bgcolor="0xeaeaea" text="contextmenu"
oninit="canvas.makeContextMenu(this)" />
       <inputtext text="contextmenu"
oninit="canvas.makeContextMenu(this)" />
       <inputtext bgcolor="0xeaeaea" text="contextmenu"
oninit="canvas.makeContextMenu(this)" />
   </view>

</canvas>

Mamye Kratt - 27/Mar/08 09:48 AM
(pagan-deities branch r8434 - mars rc/4.0.11)
This and LPP5636 appear to be missing in the branch.

Henry Minsky - 27/Mar/08 11:02 AM
test case from andre, packaged as a tar file

Mamye Kratt - 27/Mar/08 12:07 PM
(pagan-deities branch build r8434 - mars/4.0.11)

I'm getting different results in swf and dhtml. Henry can you look at the attachments?

2 of the views do not work in swf, no error (3rd and 4th to last in second column)
Also in swf, views in center column after view 10 get the standard menu when the user right clicks on the png.

Henry Minsky - 17/Jun/08 12:10 PM
I'm going to split this into a separate bug; the issue of the view not showing up at all when a view has a bgcolor and an image resource.

Amy Muntz - 27/Aug/08 08:06 AM
Andre - any chance you can address this along with the other context menu work you are doing? Would appreciate it. Thanks!

André Bargull - 09/Oct/08 02:53 AM
Image loading failures in swf are caused by this changeset for LPP-3877, particularly the change in "LzMakeLoadSprite.setResource()".
------------------------------------------------------------------------
r4714 | max | 2007-04-13 20:27:27 +0200 (Fri, 13 Apr 2007) | 29 lines
Ge?\195?\164nderte Pfade:
   M /openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
   M /openlaszlo/branches/legals/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs

Change 20070412-maxcarlson-G by maxcarlson@plastik on 2007-04-12 20:17:13 PDT
    in /Users/maxcarlson/openlaszlo/legals-clean
    for http://svn.openlaszlo.org/openlaszlo/branches/legals

Summary: Fix resourcewidth and height for proxied swf and image loading

New Features:

Bugs Fixed: LPP-3877 - Loading images in proxyless mode can lead to false onload events with resourceheight/width of 0

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:


Tests: See http://jira.openlaszlo.org/jira/browse/LPP-3877. Load http://localhost:8080/legals/my-apps/grigloadswf.lzx and http://localhost:
8080/legals/my-apps/grigloadswf.lzx?lzproxied=false after clearing caches. You should see exactly one onload event for each button, with val
id/nonzero resource width and height. Also reload after or during existing load.

Files:
M WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
M WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20070412-maxcarlson-G.tar

------------------------------------------------------------------------

André Bargull - 13/Oct/08 01:44 PM
Attached updated testcase "lpp-5670__UPDATE.lzx"

André Bargull - 14/Oct/08 02:00 AM
------------------------------------------------------------------------
r11441 | bargull | 2008-10-14 10:59:36 +0200 (Tue, 14 Oct 2008) | 35 lines
Ge?\195?\164nderte Pfade:
   M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMakeLoadSprite.as
   M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzMediaLoader.lzs
   M /openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf/LzSprite.as

Change 20081013-bargull-hYz by bargull@dell--p4--2-53 on 2008-10-13 22:23:17
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: flash context menu fixes

New Features:

Bugs Fixed: LPP-5670, LPP-7146, LPP-7154

Technical Reviewer: hminsky
QA Reviewer: max
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
LzMediaLoader:
Changed execution order so that requests are removed from the loading queue before dispatching the "onloaddone"-event
This fixes an issue from the original testcase where the last two views needed to be set to visible manually.
LzMakeLoadSprite:
Call "updateAfterLoad()" in "setResource()", but make sure you don't send the "onload"-event on the view. But this requires you to call "doQ
euedPlayAction()" manually!
With that change all four yellows in the middle column are visible. And the context-menu will work, too. And "onframe"-events are working ag
ain.
LzSprite:
Moved all 're-apply context-menu' code into "attachResourceToChildView()" and "attachBackgroundToChild()".




Tests:
see testcases at bugreports


------------------------------------------------------------------------