Highlighted

convert flash to html5, global variable problem

New Here ,
Aug 04, 2020

Copy link to clipboard

Copied

Hi,

 

i'm trying to convert files in Flash to HTML5 Canevas. 

My current problem is the global variables being generated, they cause an error. _Global is not defined.

 

To start I already modify the code to change images with button, passing from that:

BtnSuiv.onRelease = function() {
_global.Exo.gotoAndPlay("Explication02");
};

to that :

this.BtnSuiv.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));
        
            function fl_ClickToGoToAndPlayFromFrame() {
                this.gotoAndPlay(15);
            }
But i still have an error on the rest of the build, especially for launching an audio in files. The code gCh.script_mc.gestionSon (Code + "01b.mp3"); does not work, because the gCh. is not defined, just like the _global of the other variables below. Do you know what to replace global variable in JS and HTML canevas, and how I could run an audio with correct code.
 

// Globale pour situer le niveau de l'étape
_global.Exo = this;
// Globale qui enlève le clignotement de la fleche "étape suivante"
gInterface.finEtape(0);
// Globale qui initialise les bulles de la mascotte
_global.BulleRepExo = 0;
//Attitude de la mascotte
gInterface.FCTmascotte("Explication01");
//Gestion du son
gCh.script_mc.gestionSon("H0104_01_01a.mp3");

 

Thanks in advance for your help !

TOPICS
Code, Error, How to, Import and export

Views

63

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

convert flash to html5, global variable problem

New Here ,
Aug 04, 2020

Copy link to clipboard

Copied

Hi,

 

i'm trying to convert files in Flash to HTML5 Canevas. 

My current problem is the global variables being generated, they cause an error. _Global is not defined.

 

To start I already modify the code to change images with button, passing from that:

BtnSuiv.onRelease = function() {
_global.Exo.gotoAndPlay("Explication02");
};

to that :

this.BtnSuiv.addEventListener("click", fl_ClickToGoToAndPlayFromFrame.bind(this));
        
            function fl_ClickToGoToAndPlayFromFrame() {
                this.gotoAndPlay(15);
            }
But i still have an error on the rest of the build, especially for launching an audio in files. The code gCh.script_mc.gestionSon (Code + "01b.mp3"); does not work, because the gCh. is not defined, just like the _global of the other variables below. Do you know what to replace global variable in JS and HTML canevas, and how I could run an audio with correct code.
 

// Globale pour situer le niveau de l'étape
_global.Exo = this;
// Globale qui enlève le clignotement de la fleche "étape suivante"
gInterface.finEtape(0);
// Globale qui initialise les bulles de la mascotte
_global.BulleRepExo = 0;
//Attitude de la mascotte
gInterface.FCTmascotte("Explication01");
//Gestion du son
gCh.script_mc.gestionSon("H0104_01_01a.mp3");

 

Thanks in advance for your help !

TOPICS
Code, Error, How to, Import and export

Views

64

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 04, 2020 0
New Here ,
Aug 04, 2020

Copy link to clipboard

Copied

edit : 

I found a script file in my folders. This file defines the global variables. My current problem is to call it in my files. The conversion gives me this code to make the link between my current file and the script that defines the variables, but the loadMovie code seems obsolete :

 

_global.gCh = this;
if (_global.rNavigation == undefined) {
if (this._parent == undefined) {
//joué en mode auteur dans cette étape
loadMovie("../scripts.js", script_mc);
} else {
//joué en mode auteur dans interface.fla
loadMovie("scripts.js", script_mc);
}
} else {
//joué dans le navigateur
loadMovie("asset/scripts.js", script_mc);
}

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 04, 2020 0
Community Beginner ,
Aug 04, 2020

Copy link to clipboard

Copied

in Canvas you should use 'stage' instead of global
_global.varName    ==> stage.varName

and "exportRoot" instead of "_root"

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 04, 2020 0
Adobe Community Professional ,
Aug 04, 2020

Copy link to clipboard

Copied

You can use either exportRoot or stage for storage. They're both global objects that you can stuff anything into it. But it might actually be easier for him to port existing code by just creating a new global object named _global. Just add this somewhere in the initialization code:

window._global = {};

Voila, AS2-like global storage.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 04, 2020 0
PtitLu LATEST
New Here ,
Aug 05, 2020

Copy link to clipboard

Copied

hey, 

I neglected to tell you that the file I was passing from action script to html canvas was already obsolete. It's content in action script 2 that is transcribed in action script 3 in adobe animate.
This leads me to believe that I have to completely change my method of handling these variables. After a thorough analysis of every important file, I can't find any functions, objects that define global variables, gCh etc, which are followed by information like sound or mascot and are supposed to return content like sound or images to specific folders.

 

I didn't understand the terms "exportRoot" and "stage" for storage.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 05, 2020 0