I am an ancient programmer trying to use HTML5 with some difficulty, I used to call a global function "MouseSandler" With the local variables in that function including X and Listsong.
is within a function Muvhandlr Maushandlr, and The code is: It seems that the value of the "X" defined in the outer function Mauschandler for localax Has been set up properly, but Antrmndl Holhandr within LastMsg a (implicitly declared) local variable appears, but the reference mouse than to define the final message in the outer function Maushandlr (as I expected) Experimenting. LSTMsg seems to be the value of the last message of the external function, as can be expected. Am I clarifying something here? Can I direct for an online reference to the realm of variables for HTML5 which will explain this issue to me? These scoping problems are completely related to JavaScript, and not much HTML5. Javascript's variable scope, though the C-family is likely to be similar to block scope, actually the function level scripts will start with the Javascript interiors function and "Hull" will be searched for variables, therefore because your When you change There are good links to read about this: if (PostFunc) is a breakpoint on I get the value of local variables:
var MouseHandler = function (canvas1, terraincvs1, PostFunc1) {// ... var X, Y; Var LastMsg = "QQQ"; // ... function HillHandler () {var ABCStr = Mouse.LastMsg; Var DEFStr = LastMsg; Var localx = x; // ... LastMsg = "move" + X + ',' Y; If PostFunc (); Return ( "last" message: LastMsg}} cvs.addEventListener ( "Musudaun" Daunlaistnr, false); "DAS" DX, "DY" DY "Daunaks" Daunaks, down Listnr, "Holhandlr" Muvhandlr, Offset X "Ofsetaks, offset Y" "Daunwai" down Y "down" down, "Lastmogj" Lastmog}} // ... var icons = new Maushandlr (canvas, hexa Kanws, Postmous);
LastMsg the definition of your
MoveHandler () was not in function, went JavaScript your
MouseHandler anonymous defined in the variable function within the Open the series and met him at
LastMsg string
QQQ and solved.
LastMsg into the
MoveHandler () function, then Javascript skips the
QQQ value only and Creates a new string and specifies the reference to that variable because JavaScript strings are irreversible .
No comments:
Post a Comment