[jQuery] Re: Func outside of doc.ready cannot access function inside doc.ready? Why not?

2008-04-04 Thread Andy Matthews

okay...

As an interim step, and one that I really don't like, I dumped all of the
code contained within the doc.ready block, directly inside the
initBlazeDSCode method. I've got it working now, but it's ugly and I really
don't like doing it this way.

Does anyone have a better way to do this?

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Friday, April 04, 2008 3:22 PM
To: jQuery (English)
Subject: [jQuery] Re: Func outside of doc.ready cannot access function
inside doc.ready? Why not?


I'm still having trouble with this. All of my code is already written inside
the doc.ready function. The code which needs to be located outside of the
doc.ready function HAS to be able to call code within the doc.ready body.
I'd be GREATLY in debt to anyone who could help me resolve this issue.

Here's a sample of my code:


<!--
FDMSLibrary.load("FDMSBridge.swf", initBlazeDSCode);
function initBlazeDSCode() {
alert('blaze ready');
consumer.addEventListener("message", messageHandler);
}
function messageHandler(e) {
alert('got the message');
}
//-->


<!--
$(document).ready(function(){
bh = function() {
return {
runMeNow: function () {
alert('runMeNow');
}
}
}
});
//-->





[jQuery] Re: Func outside of doc.ready cannot access function inside doc.ready? Why not?

2008-04-04 Thread Mike Alsup

>  I'm still having trouble with this. All of my code is already written
>  inside the doc.ready function. The code which needs to be located
>  outside of the doc.ready function HAS to be able to call code within
>  the doc.ready body. I'd be GREATLY in debt to anyone who could help me
>  resolve this issue.

Are you saying that you have a function defined inside doc-ready that
needs to be invoked by some other code (outside of doc-ready)?  If so,
why don't you just declare the fn outside of doc-ready?

As you've written it, any code any where could call your global bh
function (after the doc has loaded).


[jQuery] Re: Func outside of doc.ready cannot access function inside doc.ready? Why not?

2008-04-04 Thread Jeffrey Kretz

If I understand your question, you want the "bh" function to be accessible
outside the "document.ready" scope.

One option would be to define some global namespace, and then assign the bh
method to that global namespace object.  Something like:

window.myNamespace = {};

$(document).ready(function(){

   window.myNamespace.bh = function(){ blabla... };

});

Then, outside the scope of the ready, you can still access
window.myNamespace.bh.

JK

-Original Message-
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andy Matthews
Sent: Friday, April 04, 2008 1:22 PM
To: jQuery (English)
Subject: [jQuery] Re: Func outside of doc.ready cannot access function
inside doc.ready? Why not?


I'm still having trouble with this. All of my code is already written
inside the doc.ready function. The code which needs to be located
outside of the doc.ready function HAS to be able to call code within
the doc.ready body. I'd be GREATLY in debt to anyone who could help me
resolve this issue.

Here's a sample of my code:


<!--
FDMSLibrary.load("FDMSBridge.swf", initBlazeDSCode);
function initBlazeDSCode() {
alert('blaze ready');
consumer.addEventListener("message", messageHandler);
}
function messageHandler(e) {
alert('got the message');
}
//-->


<!--
$(document).ready(function(){
bh = function() {
return {
runMeNow: function () {
alert('runMeNow');
}
}
}
});
//-->




[jQuery] Re: Func outside of doc.ready cannot access function inside doc.ready? Why not?

2008-04-04 Thread Andy Matthews

I'm still having trouble with this. All of my code is already written
inside the doc.ready function. The code which needs to be located
outside of the doc.ready function HAS to be able to call code within
the doc.ready body. I'd be GREATLY in debt to anyone who could help me
resolve this issue.

Here's a sample of my code:









[jQuery] Re: Func outside of doc.ready cannot access function inside doc.ready? Why not?

2008-04-02 Thread Josh Nathanson
Andy - as you may have guessed, you have a scoping issue.  Everything inside 
the doc.ready call is in an anyonymous function.

Any functions inside doc.ready that you need to have access to from *outside* 
doc.ready, you'll need to scope accordingly.

You might want to create a variable outside doc.ready like "var global.fns = 
{}" and then inside doc.ready define your functions like "global.fns.myfunc = 
function()".  This will allow you to have access to the functions in that 
variable from anywhere.

-- Josh



  - Original Message - 
  From: Andy Matthews 
  To: [jQuery] 
  Sent: Wednesday, April 02, 2008 2:15 PM
  Subject: [jQuery] Func outside of doc.ready cannot access function inside 
doc.ready? Why not?


  As a follow up to my post on "Flex Ajax Bridge & jQuery"...

  I found that if I place the offending code OUTSIDE the doc.ready call, it 
works okay, and the doc.ready still fires correctly. However, the code which is 
outside of the doc.ready call cannot access functions INSIDE the doc.ready call.

  Why is this, and how might I be able to get around it?

  

  Andy Matthews
  Senior ColdFusion Developer

  Office:  615.627.9747
  Fax:  615.467.6249
  www.dealerskins.com

  Total customer satisfaction is my number 1 priority! If you are not 
completely satisfied with the service I have provided, please let me know right 
away so I can correct the problem, or notify my manager Aaron West at [EMAIL 
PROTECTED]
<<2008 Email NADA.jpg>>