Flash and NorCascade

Another automatic cascading menu for Actinic 5 onwards. This one allows more modern DHTML effects.
Post Reply
bwshop
Posts: 18
Joined: Tue Oct 10, 2006 12:30 pm

Flash and NorCascade

Post by bwshop » Fri Mar 30, 2007 10:39 am

Morning! Another problem encountered...

Put some flash on the home page by creating a new fragment in Actinic (copying and pasting the coding from Dreamweaver) - looks fine, but I've noticed the NorCascade JavaScript Array actually 'pops out' BEHIND the flash movie. http://www.bwshop.co.uk

Could you advise on how to fix this?

Regards,
Matt
BWShop.co.uk

norman
Site Admin
Posts: 1238
Joined: Sat Feb 07, 2004 9:55 pm

Post by norman » Fri Mar 30, 2007 11:13 am

This is a well-known problem with Flash and other widgets (like SELECT boxes). The fix is from http://www.twinhelix.com (who wrote and get paid for the DHTML code ( http://www.twinhelix.com/dhtml/popupmenu/ ) that NorCascade uses.

Twinhelix have this ( http://www.twinhelix.com/cgi-bin/forum. ... phelp/1279 ) support article.


The code referred to is quite complex. Here it is.

Code: Select all

// SELECT BOX HIDING
//
// I have included two methods here for you to use; see which one suits you best...

// METHOD ONE: IE5.5+ SELECT BOX FIX
// This will allow the menus to display over SELECT boxes in IE5.5+ browsers.
// It will do nothing for NS4 or IE5.0 and earlier.
// To activate: paste this afte your menu data (either in the POP_DATA file, or your frameset)
// and then make sure you call IE55SelectBoxFix() for all your menu objects you want fixed.

function IE55SelectBoxFix(menuObj) { with (menuObj)
{
 if (window.createPopup) for (var mN in menu) with (menu[mN][0])
 {
  extraHTML += '<iframe src="about:blank" style="position: absolute; left: 0px; top: 0px; width: ' +
   menuW + 'px; height: ' + menuH + 'px; z-index: 0; border: none; ' +
   'filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)"></iframe>';
 }
}};
IE55SelectBoxFix(pMenu);



// METHOD TWO: DYNAMIC SHOW AND HIDE
// This can hide any element, like applets, movies and IFRAMEs, and it is more complicated :).
// To activate: Paste this into your menu data file (either POP_DATA or the frameset).
// This must be near the end of the file, after your menu animation settings in particular.
// It will automatically apply itself to all menus in that page.
// This function will have no effect on NS4's form behaviour.

PopupMenu.prototype.elementHide = function(mN, show)
{
 var hideTags = [];
 // <select> is hidden in all IE versions, and Opera < 7.0.
 if ((isIE && !isOp) || (isOp && !document.documentElement)) hideTags[hideTags.length] = 'SELECT';
 // <iframe> is hidden in IE < 5.5, all Opera versions, and Mozilla < 1.0.
 if ((isIE && !isOp && !window.createPopup) || isOp ||
  navigator.userAgent.match('rv:0.')) hideTags[hideTags.length] = 'IFRAME';
 // <object> and <applet> are hidden in all browsers.
 hideTags[hideTags.length] = 'OBJECT';
 hideTags[hideTags.length] = 'APPLET';

 with (this.menu[mN][0])
 {
  if (!lyr || !lyr.ref) return;

  var oldFn = show ? 'ehShow' : 'ehHide';
  if (this[oldFn]) this[oldFn](mN);
  else this.menu[mN][0].lyr.vis(show ? 'visible' : 'hidden');
  if (!isDOM && !isIE) return;

  if (hideTags.length == -1) return;
  if (!this.hideElms) this.hideElms = [];
  var hE = this.hideElms;
  if (show)
  {
   var elms = [], w = par?eval(par):self;
   for (var t = 0; t < hideTags.length; t++)
   {
    var tags = isDOM ? w.document.getElementsByTagName(hideTags[t]) :
     isIE ? w.document.all.tags(hideTags[t]) : null;
    for (var i = 0; i < tags.length; i++) elms[elms.length] = tags[i];
   }
   for (var eN = 0; eN < elms.length; eN++)
   {
    var eRef = elms[eN];
    with (w.page.elmPos(eRef)) var eX = x, eY = y;
    if (!(lyr.x()+menuW<eX || lyr.x()>eX+eRef.offsetWidth) &&
        !(lyr.y()+menuH<eY || lyr.y()>eY+eRef.offsetHeight))
    {
     if (!hE[eN]) hE[eN] = { ref: eRef, menus: [] };
     hE[eN].menus[mN] = true;
     eRef.style.visibility = 'hidden';
    }
   }
  }
  else for (var eN in hE)
  {
   var reShow = 1, eD = hE[eN];
   eD.menus[mN] = false;
   for (var eM in eD.menus) reShow &= !eD.menus[eM];
   if (reShow && eD.ref)
   {
    eD.ref.style.visibility = 'visible';
    delete hE[eN];
   }
  }
 }
 return;
}
for (var p in PopupMenu.list)
{
 var pm = PopupMenu.list[p];
 pm.ehShow = pm.showMenu;
 pm.showMenu = new Function('mN','this.elementHide(mN, true)');
 pm.ehHide = pm.hideMenu;
 pm.hideMenu = new Function('mN','this.elementHide(mN, false)');
}
Unfortunately you probably need the long winded METHOD TWO.
Norman

bwshop
Posts: 18
Joined: Tue Oct 10, 2006 12:30 pm

Post by bwshop » Fri Mar 30, 2007 11:32 am

HI Norman

Thanks for that - any advice on the best place to put the code? Also, our site is slow and I've been told it's very Javascript heavy - is this down to the NorCascade, and if so any ideas on how to improve the performance?

Cheers,
Matt.

norman
Site Admin
Posts: 1238
Joined: Sat Feb 07, 2004 9:55 pm

Post by norman » Fri Mar 30, 2007 11:43 am

Try putting the code into Norcascade / Advanced / Extra Code. Put it after anything that's already there. Support on the DHTML bits is best done via Twinhelix as I did not write (or indeed fully understand) this code.

As to page size and speed. You Section structure generates about 70Kb of JavaScript data. This will only be downloaded once per customer visit (it'll be cached for subsequent pages). For broadband users the initial load will be negligible and dial-up users will need about 20 seconds to get it all.
Norman

bwshop
Posts: 18
Joined: Tue Oct 10, 2006 12:30 pm

Post by bwshop » Fri Mar 30, 2007 11:53 am

OK - given that a try, but made no difference - it's only on the flash movies on the home page - one way round it is to move it around, but it would be useful for future obstacles...all builds on the knowledge as they say.

With regards to the slow speed, I suspect it's something to do with the Actinic coding - I'll have a play!

Cheers Norman,
Matt

Post Reply