jQuery: The Write Less, Do More JavaScript Library

reload an SWF object from jquery

View: New views
9 Messages — Rating Filter:   Alert me  

reload an SWF object from jquery

by pacodelucia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am using Open PHp chart. It uses a flash object to display charts. I
would like to update this swf object via ajax.
I have a problem accessing the object using jquery selectors:
Here is the HTML code
<object id="reportChart" ...>

//access via pure javascript
document.getElementById('reportChart').reload("charts/
genrate_chart.php"); // this works :-)

//access via jquery
$("reportChart").reload("charts/genrate_chart.php") // does not work

Apparently $("reportChart") is not returning really an SWF "object".
Anyone has an idea if this possible with jquery?

thanks

Re: reload an SWF object from jquery

by Olaf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


pacodelucia schrieb:

> Apparently $("reportChart") is not returning really an SWF "object".
> Anyone has an idea if this possible with jquery?

This is not a correct Selectot for ID, try so:

//access via jquery
$("#reportChart").reload("charts/genrate_chart.php"); // does not work

# for ID, . for CLASS

--
Viele Grüße, Olaf

-----------------------------------
olaf.bosch@...
http://olaf-bosch.de/
http://ohorn.info/
http://www.akitafreund.de/
-----------------------------------

Re: reload an SWF object from jquery

by pacodelucia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


sorry for the type error. I meant really  that
$("#reportChart").reload("charts/genrate_chart.php");

does not work with the # selector.


On Jul 1, 3:51 pm, Olaf Bosch <olaf.bo...@...> wrote:

> pacodelucia schrieb:
>
> > Apparently $("reportChart") is not returning really an SWF "object".
> > Anyone has an idea if this possible with jquery?
>
> This is not a correct Selectot for ID, try so:
>
> //access via jquery
> $("#reportChart").reload("charts/genrate_chart.php"); // does not work
>
> # for ID, . for CLASS
>
> --
> Viele Grüße, Olaf
>
> -----------------------------------
> olaf.bo...@...://olaf-bosch.de/http://ohorn.info/http://www.akitafreund.de/
> -----------------------------------

Re: reload an SWF object from jquery

by Liam Byrne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there an error / typo in the URL being requested ?

Should it be "charts/generate_chart.php" ?

L


pacodelucia wrote:
sorry for the type error. I meant really  that
$("#reportChart").reload("charts/genrate_chart.php");

does not work with the # selector.


On Jul 1, 3:51 pm, Olaf Bosch olaf.bo...@... wrote:
  
pacodelucia schrieb:

    
Apparently $("reportChart") is not returning really an SWF "object".
Anyone has an idea if this possible with jquery?
      
This is not a correct Selectot for ID, try so:

//access via jquery
$("#reportChart").reload("charts/genrate_chart.php"); // does not work

# for ID, . for CLASS

--
Viele Grüße, Olaf

-----------------------------------
olaf.bo...@...
-----------------------------------

No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09 05:53:00


Re: reload an SWF object from jquery

by pacodelucia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi
The code I have written in my post was some how pseuodo code. That is
the reason why it contains so much typing errors. Sorry for that

Here is the code directly copied from my js file:

          document.getElementById('reportChart').reload("charts/
pie_chart.php");    //works
          $("#reportChart").reload("charts/
pie_chart.php");                                           // does not
work

I am using firefox 3.5

On Jul 1, 5:03 pm, Liam Byrne <l...@...> wrote:

> Is there an error / typo in the URL being requested ?
>
> Should it be "charts/gen_*e*_rate_chart.php" ?
>
> L
>
> pacodelucia wrote:
> > sorry for the type error. I meant really  that
> > $("#reportChart").reload("charts/genrate_chart.php");
>
> > does not work with the # selector.
>
> > On Jul 1, 3:51 pm, Olaf Bosch <olaf.bo...@...> wrote:
>
> >> pacodelucia schrieb:
>
> >>> Apparently $("reportChart") is not returning really an SWF "object".
> >>> Anyone has an idea if this possible with jquery?
>
> >> This is not a correct Selectot for ID, try so:
>
> >> //access via jquery
> >> $("#reportChart").reload("charts/genrate_chart.php"); // does not work
>
> >> # for ID, . for CLASS
>
> >> --
> >> Viele Grüße, Olaf
>
> >> -----------------------------------
> >> olaf.bo...@...://olaf-bosch.de/http://ohorn.info/http://www.akitafreund.de/
> >> -----------------------------------
> >> ------------------------------------------------------------------------
>
> >> No virus found in this incoming message.
> >> Checked by AVG -www.avg.com
> >> Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09 05:53:00

Re: reload an SWF object from jquery

by Liam Byrne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Any chance that there are 2 items with id / name "reportChart" ?

L

pacodelucia wrote:

> Hi
> The code I have written in my post was some how pseuodo code. That is
> the reason why it contains so much typing errors. Sorry for that
>
> Here is the code directly copied from my js file:
>
>  document.getElementById('reportChart').reload("charts/
> pie_chart.php");    //works
>  $("#reportChart").reload("charts/
> pie_chart.php");                                           // does not
> work
>
> I am using firefox 3.5
>
> On Jul 1, 5:03 pm, Liam Byrne <l...@...> wrote:
>  
>> Is there an error / typo in the URL being requested ?
>>
>> Should it be "charts/gen_*e*_rate_chart.php" ?
>>
>> L
>>
>> pacodelucia wrote:
>>    
>>> sorry for the type error. I meant really  that
>>> $("#reportChart").reload("charts/genrate_chart.php");
>>>      
>>> does not work with the # selector.
>>>      
>>> On Jul 1, 3:51 pm, Olaf Bosch <olaf.bo...@...> wrote:
>>>      
>>>> pacodelucia schrieb:
>>>>        
>>>>> Apparently $("reportChart") is not returning really an SWF "object".
>>>>> Anyone has an idea if this possible with jquery?
>>>>>          
>>>> This is not a correct Selectot for ID, try so:
>>>>        
>>>> //access via jquery
>>>> $("#reportChart").reload("charts/genrate_chart.php"); // does not work
>>>>        
>>>> # for ID, . for CLASS
>>>>        
>>>> --
>>>> Viele Grüße, Olaf
>>>>        
>>>> -----------------------------------
>>>> olaf.bo...@...://olaf-bosch.de/http://ohorn.info/http://www.akitafreund.de/
>>>> -----------------------------------
>>>> ------------------------------------------------------------------------
>>>>        
>>>> No virus found in this incoming message.
>>>> Checked by AVG -www.avg.com
>>>> Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09 05:53:00
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> No virus found in this incoming message.
>>>> Checked by AVG - www.avg.com
>>>> Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09 05:53:00
>>>>
>>>>        


Re: reload an SWF object from jquery

by pacodelucia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi again

I have created a demo of the described problem. Please find it here :
http://msc2svg.googlepages.com/index.html
The source code can be downloaded as zip form here :http://
msc2svg.googlepages.com/demo.zip

The demo javascript code is written in index.html


On Jul 1, 6:11 pm, Liam Byrne <l...@...> wrote:

> Any chance that there are 2 items with id / name "reportChart" ?
>
> L
>
> pacodelucia wrote:
> > Hi
> > The code I have written in my post was some how pseuodo code. That is
> > the reason why it contains so much typing errors. Sorry for that
>
> > Here is the code directly copied from my js file:
>
> >      document.getElementById('reportChart').reload("charts/
> > pie_chart.php");          //works
> >      $("#reportChart").reload("charts/
> > pie_chart.php");                                           // does not
> > work
>
> > I am using firefox 3.5
>
> > On Jul 1, 5:03 pm, Liam Byrne <l...@...> wrote:
>
> >> Is there an error / typo in the URL being requested ?
>
> >> Should it be "charts/gen_*e*_rate_chart.php" ?
>
> >> L
>
> >> pacodelucia wrote:
>
> >>> sorry for the type error. I meant really  that
> >>> $("#reportChart").reload("charts/genrate_chart.php");
>
> >>> does not work with the # selector.
>
> >>> On Jul 1, 3:51 pm, Olaf Bosch <olaf.bo...@...> wrote:
>
> >>>> pacodelucia schrieb:
>
> >>>>> Apparently $("reportChart") is not returning really an SWF "object".
> >>>>> Anyone has an idea if this possible with jquery?
>
> >>>> This is not a correct Selectot for ID, try so:
>
> >>>> //access via jquery
> >>>> $("#reportChart").reload("charts/genrate_chart.php"); // does not work
>
> >>>> # for ID, . for CLASS
>
> >>>> --
> >>>> Viele Grüße, Olaf
>
> >>>> -----------------------------------
> >>>> olaf.bo...@...://olaf-bosch.de/http://ohorn.info/http://www.akitafreund.de/
> >>>> -----------------------------------
> >>>> ------------------------------------------------------------------------
>
> >>>> No virus found in this incoming message.
> >>>> Checked by AVG -www.avg.com
> >>>> Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09 05:53:00
> >>>> ------------------------------------------------------------------------
>
> >>>> No virus found in this incoming message.
> >>>> Checked by AVG -www.avg.com
> >>>> Version: 8.5.375 / Virus Database: 270.13.1/2212 - Release Date: 07/01/09 05:53:00

Re: reload an SWF object from jquery

by KeeganWatkins :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


The issue is that your selector returns a jQuery object, not a raw
DOMElement, which is what swfobject and/or ExternalInterface expect.
Use this instead:

var elem = $("#someId")[0];
elem.reload();

the difference is that by using array access to get the first element
in the wrapped set, you can directly call methods defined in AS3. Hope
that helps.

On Jul 2, 4:23 am, pacodelucia <aziz.hamm...@...> wrote:

> Hi again
>
> I have created a demo of the described problem. Please find it here :http://msc2svg.googlepages.com/index.html
> The source code can be downloaded as zip form here :http://
> msc2svg.googlepages.com/demo.zip
>
> The demo javascript code is written in index.html
>
> On Jul 1, 6:11 pm, Liam Byrne <l...@...> wrote:
>
>
>
> > Any chance that there are 2 items with id / name "reportChart" ?
>
> > L
>
> > pacodelucia wrote:
> > > Hi
> > > The code I have written in my post was some how pseuodo code. That is
> > > the reason why it contains so much typing errors. Sorry for that
>
> > > Here is the code directly copied from my js file:
>
> > >      document.getElementById('reportChart').reload("charts/
> > > pie_chart.php");          //works
> > >      $("#reportChart").reload("charts/
> > > pie_chart.php");                                           // does not
> > > work
>
> > > I am using firefox 3.5
>
> > > On Jul 1, 5:03 pm, Liam Byrne <l...@...> wrote:
>
> > >> Is there an error / typo in the URL being requested ?
>
> > >> Should it be "charts/gen_*e*_rate_chart.php" ?
>
> > >> L
>
> > >> pacodelucia wrote:
>
> > >>> sorry for the type error. I meant really  that
> > >>> $("#reportChart").reload("charts/genrate_chart.php");
>
> > >>> does not work with the # selector.
>
> > >>> On Jul 1, 3:51 pm, Olaf Bosch <olaf.bo...@...> wrote:
>
> > >>>> pacodelucia schrieb:
>
> > >>>>> Apparently $("reportChart") is not returning really an SWF "object".
> > >>>>> Anyone has an idea if this possible with jquery?
>
> > >>>> This is not a correct Selectot for ID, try so:
>
> > >>>> //access via jquery
> > >>>> $("#reportChart").reload("charts/genrate_chart.php"); // does not work
>
> > >>>> # for ID, . for CLASS
>
> > >>>> --
> > >>>> Viele Grüße, Olaf
>
> > >>>> -----------------------------------
> > >>>> olaf.bo...@...://olaf-bosch.de/http://ohorn.info/http://www.akitafreund.de/
> > >>>> -----------------------------------
> > >>>> ------------------------------------------------------------------------
>
> > >>>> No virus found in this incoming message.
> > >>>> Checked by AVG -www.avg.com
> > >>>> Version: 8.5.375 / Virus Database:270.13.1/2212- Release Date:07/01/09 05:53:00
> > >>>> ------------------------------------------------------------------------
>
> > >>>> No virus found in this incoming message.
> > >>>> Checked by AVG -www.avg.com
> > >>>> Version: 8.5.375 / Virus Database:270.13.1/2212- Release Date:07/01/09 05:53:00

Re: reload an SWF object from jquery

by pacodelucia :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks for the clarification. I can now access the swf object and
reload it.  :-)


On Jul 2, 6:40 pm, KeeganWatkins <mkeeganwatk...@...> wrote:

> The issue is that your selector returns a jQuery object, not a raw
> DOMElement, which is what swfobject and/or ExternalInterface expect.
> Use this instead:
>
> var elem = $("#someId")[0];
> elem.reload();
>
> the difference is that by using array access to get the first element
> in the wrapped set, you can directly call methods defined in AS3. Hope
> that helps.
>
> On Jul 2, 4:23 am, pacodelucia <aziz.hamm...@...> wrote:
>
> > Hi again
>
> > I have created a demo of the described problem. Please find it here :http://msc2svg.googlepages.com/index.html
> > The source code can be downloaded as zip form here :http://
> > msc2svg.googlepages.com/demo.zip
>
> > The demo javascript code is written in index.html
>
> > On Jul 1, 6:11 pm, Liam Byrne <l...@...> wrote:
>
> > > Any chance that there are 2 items with id / name "reportChart" ?
>
> > > L
>
> > > pacodelucia wrote:
> > > > Hi
> > > > The code I have written in my post was some how pseuodo code. That is
> > > > the reason why it contains so much typing errors. Sorry for that
>
> > > > Here is the code directly copied from my js file:
>
> > > >      document.getElementById('reportChart').reload("charts/
> > > > pie_chart.php");          //works
> > > >      $("#reportChart").reload("charts/
> > > > pie_chart.php");                                           // does not
> > > > work
>
> > > > I am using firefox 3.5
>
> > > > On Jul 1, 5:03 pm, Liam Byrne <l...@...> wrote:
>
> > > >> Is there an error / typo in the URL being requested ?
>
> > > >> Should it be "charts/gen_*e*_rate_chart.php" ?
>
> > > >> L
>
> > > >> pacodelucia wrote:
>
> > > >>> sorry for the type error. I meant really  that
> > > >>> $("#reportChart").reload("charts/genrate_chart.php");
>
> > > >>> does not work with the # selector.
>
> > > >>> On Jul 1, 3:51 pm, Olaf Bosch <olaf.bo...@...> wrote:
>
> > > >>>> pacodelucia schrieb:
>
> > > >>>>> Apparently $("reportChart") is not returning really an SWF "object".
> > > >>>>> Anyone has an idea if this possible with jquery?
>
> > > >>>> This is not a correct Selectot for ID, try so:
>
> > > >>>> //access via jquery
> > > >>>> $("#reportChart").reload("charts/genrate_chart.php"); // does not work
>
> > > >>>> # for ID, . for CLASS
>
> > > >>>> --
> > > >>>> Viele Grüße, Olaf
>
> > > >>>> -----------------------------------
> > > >>>> olaf.bo...@...://olaf-bosch.de/http://ohorn.info/http://www.akitafreund.de/
> > > >>>> -----------------------------------
> > > >>>> ------------------------------------------------------------------------
>
> > > >>>> No virus found in this incoming message.
> > > >>>> Checked by AVG -www.avg.com
> > > >>>> Version: 8.5.375 / Virus Database:270.13.1/2212- Release Date:07/01/09 05:53:00
> > > >>>> ------------------------------------------------------------------------
>
> > > >>>> No virus found in this incoming message.
> > > >>>> Checked by AVG -www.avg.com
> > > >>>> Version: 8.5.375 / Virus Database:270.13.1/2212- Release Date:07/01/09 05:53:00