Skip to main content
Participant
February 22, 2021
Answered

convert AS3 in HTML5 Object(root)

  • February 22, 2021
  • 1 reply
  • 596 views

Good evening,

 

I try to convert some animate I made in AS3 to HTML5 . I don't know how to transform the following lines :

this.stop ();



this.O2_btn.addEventListener("click", dioxygene.bind(this));

function dioxygene()
{
	this.Object(root).dioxygene_clp.play();
}

this.glucose_btn.addEventListener("click", glucose.bind(this));

function glucose()
{
	Object(root).glucose_clp.play();
}

this.plus_btn.addEventListener("click", lectureCO2.bind(this));

function lectureCO2 ()
{
if (this.Object(root).glucose_clp.currentFrame==96){
	if(this.Object(root).dioxygene_clp.currentFrame==96){
		this.Object(root).CO2_clp.gotoAndPlay (2);
		this.Object(root).ampoule.gotoAndStop(2);
}
}
}

I just put some this but I think not in the right places.

 

I'll be happy if some of you can help me, please excuse my bad english.

 

Best regards

    This topic has been closed for replies.
    Correct answer kglad

    replace

     

    this.Object(root)

     

    with

     

    exportRoot

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    February 22, 2021

    replace

     

    this.Object(root)

     

    with

     

    exportRoot

    Participant
    February 22, 2021

    Hi,

     

    thanks, it works until plus_btn which does nothing

    this.stop ();
    
    
    
    this.O2_btn.addEventListener("click", dioxygene.bind(this));
    
    function dioxygene()
    {
    	exportRoot.dioxygene_clp.play();
    }
    
    this.glucose_btn.addEventListener("click", glucose.bind(this));
    
    function glucose()
    {
    	exportRoot.glucose_clp.play();
    }
    
    this.plus_btn.addEventListener("click", lectureCO2.bind(this));
    
    function lectureCO2 ()
    {
    if (exportRoot.glucose_clp.currentFrame==96){
    	if(exportRoot.dioxygene_clp.currentFrame==96){
    		exportRoot.CO2_clp.gotoAndPlay (2);
    		exportRoot.ampoule.gotoAndStop(2);
    }
    }
    }

     

    so I imagine it's the conditionnal function or the current frame that need a change

     

    Best regards

     

    Thomas

     

     

    Participant
    February 22, 2021

    No, it's good, I've frogotten change the number of the frame to count the 0 image instead of 1

     

    thanks a lot !!!

    Best regards