Loading ...
Sorry, an error occurred while loading the content.

37348Re: Flex widget inside layout manager cannot be called from javascript in IE

Expand Messages
  • aniad
    Sep 5, 2008
    • 0 Attachment
      Hi Dav,

      Thank you! That did the trick, ie creating flex after layout is
      rendered. Thanks again!

      Any chance my other posting/problem can be looked at:
      http://tech.groups.yahoo.com/group/ydn-javascript/message/37191

      Much obliged,
      Ania.

      --- In ydn-javascript@yahoogroups.com, Dav Glass <dav.glass@...> wrote:
      >
      > Again, the issue is you are creating the Flex object "before" the
      layout is rendered..
      >
      > It needs to be created "after", since Layout will move the node
      around in the dom to position it correctly.
      >
      > Moving the node after it has been built is where the issue is..
      >
      > Does that make sense?
      > Dav
      >
      > Dav Glass
      > dav.glass@...
      > blog.davglass.com
      >
      >
      >
      >
      > + Windows: n. - The most successful computer virus, ever. +
      > + A computer without a Microsoft operating system is like a dog
      > without bricks tied to its head +
      > + A Microsoft Certified Systems Engineer is to computing what a
      > McDonalds Certified Food Specialist is to fine cuisine +
      >
      >
      >
      > ----- Original Message ----
      > > From: aniad <aniad@...>
      > > To: ydn-javascript@yahoogroups.com
      > > Sent: Friday, September 5, 2008 12:32:34 PM
      > > Subject: [ydn-javascript] Re: Flex widget inside layout manager
      cannot be called from javascript in IE
      > >
      > > One typo in my previous reply:
      > >
      > > in callFlex() the 'widgetId' should be initialized to 'flexWidget'
      > > (not 'flexWidgetIE'), so that function looks like this:
      > >
      > > function callFlex()
      > > {
      > > var widgetId = "flexWidget";
      > > if ( isIE )
      > > widgetId = "flexWidgetIE";
      > >
      > > // This will not work if layout was created and the Flex widget is
      > > hosted inside it.
      > >
      > >
      document.getElementById(widgetId).Flex_TestExternalInterface("one","two");
      > > }
      > >
      > > --- In ydn-javascript@yahoogroups.com, "aniad" wrote:
      > > >
      > > > Dav,
      > > >
      > > > Thank you for your reply. Unfortunately, changing the code does not
      > > > solve this issue.
      > > > I've changed the code to use object/embed tags instead of doing
      > > > document.write, and I continue to have the same problem.
      > > > My code looks like this now:
      > > >
      > > >
      > > >
      > > >
      > > >
      > I am
      > > center
      > > >
      > > >
      >
      > > >
      > > >
      > > >
      > > >
      > > >
      > > > Click me
      > > >
      > > >
      > > >
      > > > Ania.
      > > >
      > > >
      > > >
      > > > --- In ydn-javascript@yahoogroups.com, Dav Glass wrote:
      > > > >
      > > > > aniad --
      > > > >
      > > > > The issue is that your script is doing a document.write of the
      embed
      > > > tags into the div "centerDivWithFlex".
      > > > > Then when the Layout is rendered, it's moving it in the DOM.
      > > > > IE (and most browsers) don't like it when you do that..
      > > > >
      > > > > What you need to do, it remove the use of document.write and
      use DOM
      > > > to add the embed info to the div
      > > > > AFTER the layout is rendered by listening to the Layout's render
      > > event..
      > > > >
      > > > > layout.on('render', initFlex);
      > > > >
      > > > > Does that make sense?
      > > > > Dav
      > > > >
      > > > > Dav Glass
      > > > > dav.glass@
      > > > > blog.davglass.com
      > > > >
      > > > >
      > > > >
      > > > >
      > > > > + Windows: n. - The most successful computer virus, ever. +
      > > > > + A computer without a Microsoft operating system is like a dog
      > > > > without bricks tied to its head +
      > > > > + A Microsoft Certified Systems Engineer is to computing what a
      > > > > McDonalds Certified Food Specialist is to fine cuisine +
      > > > >
      > > > >
      > > > >
      > > > > ----- Original Message ----
      > > > > > From: aniad
      > > > > > To: ydn-javascript@yahoogroups.com
      > > > > > Sent: Friday, September 5, 2008 11:14:27 AM
      > > > > > Subject: [ydn-javascript] Re: Flex widget inside layout manager
      > > > cannot be called from javascript in IE
      > > > > >
      > > > > > Hi Dav,
      > > > > >
      > > > > > I don't mean to come off impatient, but w/o some insight
      into this
      > > > > > problem our app will not work in IE. I will very much
      > > appreciate any
      > > > > > advise/observations you might have.
      > > > > > a.
      > > > > >
      > > > > > --- In ydn-javascript@yahoogroups.com, "aniad" wrote:
      > > > > > >
      > > > > > > Hello Dav,
      > > > > > >
      > > > > > > I don't really have a site available that is outside of a
      > > > firewall, so
      > > > > > > I have a zip file for you here:
      > > > > > >
      > > > > > > https://download.amberpoint.com/forYahoo/forYUI.zip
      > > > > > > Username: Yahoo
      > > > > > > Password: bug4yahoo
      > > > > > >
      > > > > > > Please put these files on some server and then access
      > > > > > > flexInLayoutProblem.html (it has to be accessed via some
      server,
      > > > > > > localhost for example, not local file system, otherwise flex
      > > > runs into
      > > > > > > security problems)
      > > > > > >
      > > > > > > As I've commented in that .html file, if you create the flex
      > > widget
      > > > > > > outside of the layout manager then calling it in IE is not a
      > > > problem.
      > > > > > > However, putting the flex widget inside the layout prevents
      > > it from
      > > > > > > being able to be called in IE. It works fine in Firefox.
      > > > > > >
      > > > > > > I've also included TestExternalInterface.zip which is the
      > > source for
      > > > > > > the simple flex widget.
      > > > > > >
      > > > > > > Please advise.
      > > > > > > Ania.
      > > > > > >
      > > > > > >
      > > > > > >
      > > > > > > --- In ydn-javascript@yahoogroups.com, Dav Glass wrote:
      > > > > > > >
      > > > > > > > aniad --
      > > > > > > >
      > > > > > > > Please post a link so I can see it, the code doesn't help me
      > > if I
      > > > > > > can't see the issue :D
      > > > > > > >
      > > > > > > > Thanks
      > > > > > > > Dav
      > > > > > > >
      > > > > > > > Dav Glass
      > > > > > > > dav.glass@
      > > > > > > > blog.davglass.com
      > > > > > > >
      > > > > > > >
      > > > > > > >
      > > > > > > >
      > > > > > > > + Windows: n. - The most successful computer virus, ever. +
      > > > > > > > + A computer without a Microsoft operating system is
      like a dog
      > > > > > > > without bricks tied to its head +
      > > > > > > > + A Microsoft Certified Systems Engineer is to computing
      what a
      > > > > > > > McDonalds Certified Food Specialist is to fine cuisine +
      > > > > > > >
      > > > > > > >
      > > > > > > >
      > > > > > > > ----- Original Message ----
      > > > > > > > > From: aniad
      > > > > > > > > To: ydn-javascript@yahoogroups.com
      > > > > > > > > Sent: Tuesday, September 2, 2008 10:54:42 AM
      > > > > > > > > Subject: [ydn-javascript] Flex widget inside layout
      manager
      > > > cannot
      > > > > > > be called from javascript in IE
      > > > > > > > >
      > > > > > > > > Hello,
      > > > > > > > >
      > > > > > > > > I'm having a real problem with Layout Manager hosting
      a flex
      > > > > > widget in
      > > > > > > > > the center pane in IE. Specifically the problem has to do
      > > with
      > > > > > > > > javascript calling flex. The flex widget registers
      javascript
      > > > > > > > > callbacks which work fine in Firefox. However they do
      not in
      > > > > > IE. The
      > > > > > > > > problem is directly related to the Layout Manager, as
      > > > > > eliminating the
      > > > > > > > > Layout, ie putting the flex widget just in a simple
      > > > > > > > , solves the
      > > > > > > > > problem.
      > > > > > > > >
      > > > > > > > > My code looks something like:
      > > > > > > > >
      > > > > > > > > function initLayout()
      > > > > > > > > {
      > > > > > > > > layout = new YAHOO.widget.Layout('layoutDiv',
      > > > > > > > > {
      > > > > > > > > height: 500,//800,
      > > > > > > > > units: [
      > > > > > > > > { position: 'center', height: 490, scroll:
      > > > false,
      > > > > > > > > resize: true, body: 'selectorDiv', gutter: '2px 5px',
      > > collapse:
      > > > > > true,
      > > > > > > > > collapseSize: 50, maxWidth: 1000 }
      > > > > > > > > ]
      > > > > > > > > });
      > > > > > > > >
      > > > > > > > > }
      > > > > > > > >
      > > > > > > > > Function callFlex()
      > > > > > > > > {
      > > > > > > > >
      > > Document.getElementById("myFlexWidget").Flex_SetView(); //
      > > > > > > > > "Flex_SetView" is a registered callback in action script
      > > > > > > > > }
      > > > > > > > >
      > > > > > > > > YAHOO.util.Event.onDOMReady(initLayout);
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > > show flex problem
      > > > > > > > >
      > > > > > > > >
      > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > > The error in IE is "Unspecified Error" in some IE
      javascript
      > > > code:
      > > > > > > > >
      > > > > > > > > function __flash__addCallback(instance, name) {
      > > > > > > > > instance[name] = function () {
      > > > > > > > > return eval(instance.CallFunction(">
      > > > > > > returntype=\"javascript\">" +
      > > __flash__argumentsToXML(arguments,0) +
      > > > > > > > > ""));
      > > > > > > > > }
      > > > > > > > > }
      > > > > > > > >
      > > > > > > > > Both params, instance and name are valid. We found this
      > > > article on
      > > > > > > > > the subject,
      > > http://www.airtightinteractive.com/news/?p=71, and
      > > > > > we are
      > > > > > > > > already doing everything suggested in this article.
      Again, as
      > > > > > stated
      > > > > > > > > above, eliminating the layout manager allows the flex
      > > > callbacks to
      > > > > > > > > work again.
      > > > > > > > >
      > > > > > > > > Please advise, thank you!
      > > > > > > > >
      > > > > > > > > Ania.
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > > > ------------------------------------
      > > > > > > > >
      > > > > > > > > Yahoo! Groups Links
      > > > > > > > >
      > > > > > > > >
      > > > > > > > >
      > > > > > > >
      > > > > > >
      > > > > >
      > > > > >
      > > > > >
      > > > > > ------------------------------------
      > > > > >
      > > > > > Yahoo! Groups Links
      > > > > >
      > > > > >
      > > > > >
      > > > >
      > > >
      > >
      > >
      > >
      > > ------------------------------------
      > >
      > > Yahoo! Groups Links
      > >
      > >
      > >
      >
    • Show all 9 messages in this topic