pupsnow / mathmleditor

Automatically exported from code.google.com/p/mathmleditor
1 stars 0 forks source link

Ability to extract MathML #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
You can view the MathML in the right-hand textbox, but there is no way to 
actually programatically get at it. I suggest something along the lines of 
having a Save button that can call out to Javascript. 

For example, I can pass in via FlashVars the name of a Javascript 
function, say ?SaveFunction=saveMathML

When I click the Save button in the SWF, it will call saveMathML passing 
the MathML in the editor to the function using the External API in Flash. 
This would let me save the MathML without the user ever having to touch it.

Original issue reported on code.google.com by dmeg...@gmail.com on 2 Dec 2008 at 3:03

GoogleCodeExporter commented 9 years ago
Well I had a little free time, so I went ahead and gave this a shot. I created 
a 
FlashVar called SaveFunction. You specify the name of a function in Javascript. 
If 
you specify a SaveFunction, when you press the "Get MathML" button, it calls 
this 
function instead of displaying the MathML.

In addition to the patch, I also changed the FLA. I changed getBt's onclick to:

getBt.onPress = function () {
    // If a save function was specified, we want to call that instead of 
displaying it in the editor.
    if (_root.SaveFunction != undefined)
        ExternalInterface.call(_root.SaveFunction, editML.getMathMLString
(true));
    else
    {
        loadMathMLP._visible = false;
        if(xmlArea.x==xmlAreaX){
            var l = xmlArea.x + xmlArea.width;
            xmlArea.move(scrollPane.x, xmlArea.y)
            var w = l - scrollPane.x;
            xmlArea.setSize(w, xmlArea.height);
            xmlAreaKeybord = true;
        }else{
            xmlArea.move(xmlAreaX, xmlArea.y)
            xmlArea.setSize(xmlAreaW, xmlArea.height);
            xmlAreaKeybord = false;
        }
    }
};

You'll also need to add import flash.external.*;

Sorry, CVS doesn't handle FLA patching!

Original comment by dmeg...@gmail.com on 4 Dec 2008 at 3:14

Attachments:

GoogleCodeExporter commented 9 years ago
I have added the communication between MathML Editor and FlashVars, Javascript 
and 
server

Original comment by ionel.alexandru@gmail.com on 8 Dec 2008 at 9:58