Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onPress/onRollOver/onRollOut events don't work for MovieClip loaded from url with image #19268

Open
Aranxtonel opened this issue Jan 18, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Aranxtonel
Copy link

Aranxtonel commented Jan 18, 2025

Describe the bug

onPress/onRollOver/onRollOut events don't trigger at all for a MovieClip that was loaded as image from url using MovieClipLoader.loadClip. Events work as expected when MovieClip is created using a different method.
I assume this is not expected behaviour, because mouse cursor still changes as if event is set correctly.
Below is the PoC code. Events for "clip" trigger as expected, events for "img" don't trigger (to see the trace messages you need to set "trace" loglevel).

var clipLoader = new MovieClipLoader();
var listener = new Object();
clipLoader.addListener(listener);
var loadedClip = this.createEmptyMovieClip("img",this.getNextHighestDepth());
clipLoader.loadClip("https://ruffle.rs/demo/icon32.png",loadedClip);
listener.onLoadComplete = function(t, status)
{
   trace("Loaded: " + status);
   loadedClip.onPress = function()
   {
      trace("img onPress");
   };
   loadedClip.onRollOver = function()
   {
      trace("img onRollOver");
   };
   loadedClip.onRollOut = function()
   {
      trace("img onRollOut");
   };
};
var clip = this.createEmptyMovieClip("clip",this.getNextHighestDepth());
clip.beginFill(16711680);
clip.moveTo(100,0);
clip.lineTo(200,0);
clip.lineTo(200,100);
clip.lineTo(100,100);
clip.lineTo(100,0);
clip.endFill();
clip.onPress = function()
{
   trace("clip onPress");
};
clip.onRollOver = function()
{
   trace("clip onRollOver");
};
clip.onRollOut = function()
{
   trace("clip onRollOut");
};

Expected behavior

MovieClip events trigger as usual

Content Location

PoC code above and PoC swf: test.zip
Also, see the updated PoC code and swf in the comment below.

Affected platform

Self-hosted version

Operating system

Windows 10

Browser

Mozilla Firefox 134

Additional information

No response

@Aranxtonel Aranxtonel added the bug Something isn't working label Jan 18, 2025
@Aranxtonel
Copy link
Author

Updated PoC code and swf file to use TextField as output instead of using trace: test.zip
Now it is possible to reproduce this bug on the official ruffle demo page.

function trc(text)
{
   trace(text);
   debugText.text = text;
}
var debugText = this.createTextField("debugText",this.getnextHighestDepth(),10,200,500,50);
debugText.text = "";
debugText.autoSize = true;
var clipLoader = new MovieClipLoader();
var listener = new Object();
clipLoader.addListener(listener);
var loadedClip = this.createEmptyMovieClip("img",this.getNextHighestDepth());
clipLoader.loadClip("https://ruffle.rs/demo/icon32.png",loadedClip);
listener.onLoadComplete = function(t, status)
{
   trc("Loaded: " + status);
   loadedClip.onPress = function()
   {
      trc("img onPress");
   };
   loadedClip.onRollOver = function()
   {
      trc("img onRollOver");
   };
   loadedClip.onRollOut = function()
   {
      trc("img onRollOut");
   };
};
var clip = this.createEmptyMovieClip("clip",this.getNextHighestDepth());
clip.beginFill(16711680);
clip.moveTo(100,0);
clip.lineTo(200,0);
clip.lineTo(200,100);
clip.lineTo(100,100);
clip.lineTo(100,0);
clip.endFill();
clip.onPress = function()
{
   trc("clip onPress");
};
clip.onRollOver = function()
{
   trc("clip onRollOver");
};
clip.onRollOut = function()
{
   trc("clip onRollOut");
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant