I have a function ready(e) which inside hold a canvas and some other function. I want to make an action outside the canvas to call an function inside ready(e). How can I do that? thanks very much!!
Below is a simplified version of my code.. I want to call arraytwo() outside function ready(e)...
function ready(e)
{
var canvas;
var canvasWidth;
var canvasHeight;
var ctx;
canvas = document.getElementById('myCanvas');
canvasWidth = 1100 ;
canvasHeight = 1200;
ctx = canvas.getContext('2d');
function arraytwo()
{alert("arraytwo");}
}
arraytwo();
EDIT: Sorry i should have clarify, the function/information/data I use in arraytwo will have to be used in the canvas. alert() is just an example. so I can't put it outside ready(e).
EDIT2: there is one line of code before function ready(e). hope this information is useful :(
this.addEventListener("DOMContentLoaded", ready, true);
EDIT3: and this is the code for the canvas in html
<canvas id="myCanvas"></canvas>