Hi there,

I have encountered a strange bug. I have buttons advancing one frame forward and back.

It works in the SWF on its own, it works in both the .app and .exe projector files, but it does not work accessing the SWF via the HTML generated page.

Does anyone have an inkling what's going on?

The code on the two buttons is:

import flash.events.MouseEvent;

stage.displayState = StageDisplayState.FULL_SCREEN;

function next1Click(event:MouseEvent): void {
gotoAndStop(this.currentFrame + 1);
}
function back1Click(event:MouseEvent): void {
gotoAndStop(this.currentFrame - 1);
}

//EVENT LISTENER AND VARIABLE DECLARATION
balancingNext.addEventListener(MouseEvent.CLICK, next1Click);
balancingBack.addEventListener(MouseEvent.CLICK, back1Click);

Thanks in advance for any help!

Dani AI

Generated

The most likely cause is the call that forces full‑screen at load time (the top‑level stage.displayState assignment mentioned in the first post). Flash Player in browsers will block or throw when a SWF tries to enter full‑screen outside a direct user gesture; that can halt script execution so the later button listeners never run. pointed to the same general diagnosis elsewhere.

Quick checks (fast way to confirm)

  • Temporarily remove or comment out the full‑screen line and reload the HTML wrapper; if the buttons work then, the full‑screen call is the culprit.
  • Run the SWF with the debug Flash Player to catch any runtime errors that occur when embedded in the page.

Safe ways to keep full‑screen without breaking the page

  • Only request full‑screen from inside a user event (mouse/key). Example pattern:

    someButton.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void {
        try {
            stage.displayState = StageDisplayState.FULL_SCREEN;
        } catch (err:Error) {
            // gracefully handle or log; avoid letting an exception stop other code
        }
    });

Other embedding issues to verify

  • Check the HTML embed/OBJECT params: wmode set to transparent or opaque can change mouse behavior and disallow full‑screen — remove it or use window when full‑screen is needed. Ensure allowFullScreen is set if using embedding libraries.
  • Look for any transparent HTML/CSS overlays or absolutely positioned elements that might intercept clicks over the plugin.
  • Confirm button instances exist on the timeline/frame where listeners are attached (timeline frame changes can remove instances and listeners).

Minimal action list: comment out the full‑screen line, test in the HTML page, switch full‑screen into a user‑initiated handler with try/catch, and verify embed params and page elements for overlays.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.