[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

CF / Flash Question - Dynamic Menu need Dynamic EMBED AND PARM tag height and widths

Asked by madasczik in ColdFusion Application Server

Tags: flash, set, width

Question pertains to right naviagation of this page http://dev.fusionapps.com/wboe/dsp_home_page.cfm

Will open multiple questions if this is not an easy fix.

Wondering if there is more dynamic way of using cold fusion and flash to handle the output height and width of the swf movie.  Right now if I publish the movie clip at 200 x 450 pixels, there leaves room for two more buttons to be entered in the swf movie size.  But the right nav is always changing so if I enter a third it won't display becuase the movie size is too small in the html embed and param tags.   I could easily export the movie again with a taller height like 600 pixels but that changes the layout of the webpage because content in a lower <TR> gets pushed way down in the site and leaves an empty space.  I need to do something like this but can't figure it out.

Webpage calls SWF but waits to get width and height somehow before displaying --->  SWF calls CFM file to get cats and subcats from database then CFM outputs cats and subcats to flash ---> Flash builds the cats, subcats, and adds spacer when necessary --->  Then I need a way to add the total height and width up in flash  ---> Output these two values to the embed and param tags of the webpage that's calling the SWF.  Is this possible?


Right now I have the calling cfm:

<CFIF findNoCase("msie",HTTP_USER_AGENT)>

      <!--- Initialize swf file which calls /wboe/flash/right_nav/dsp_menu_categories.cfm to get category header,
              subcategory names and urls from database then builds buttons dynamically with a default height of 21 pixels
              and expands to compensate for multi-line buttons.
             
              There is a 3 pixel spacer between each category and subcategory.
             
              There is an insert of 50 pixels between each category in flash.
             
              If the total height of category headers, subcategories buttons and spacers is over 450 pixels,
              buttons outside of the 450 pixels will not display, need to increase the two height settings below to fix.  --->

      <OBJECT
             CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
             WIDTH="200"
             HEIGHT="450"
             ID="wboe_right_nav" ALIGN="">
                   <PARAM NAME=movie VALUE="/wboe/flash/right_nav/wboe_right_nav.swf">
                   <PARAM NAME=quality VALUE=best>
                  <PARAM NAME=menu VALUE=false>
                  <PARAM NAME=wmode VALUE=transparent>
                  <PARAM NAME=bgcolor VALUE=#FFFFFF>
                  <EMBED src="/wboe/flash/right_nav/wboe_right_nav.swf"
                        menu=false
                        quality=best
                        wmode=transparent
                        bgcolor=#FFFFFF
                        WIDTH="200"
                        HEIGHT="450"
                        NAME="wboe_right_nav"
                        ALIGN=""
                        TYPE="application/x-shockwave-flash"
                        PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
                  </EMBED>
      </OBJECT>
<CFELSE>

Non-Flash Content

</CFIF>


Here's the dsp_menu_categories.cfm that gathers the data from the database

<cfcontent type="text/plain">
<cfsetting enablecfoutputonly="yes">
<!--- query to get the main categories --->
<cfquery datasource="flashmenu" name="get_cats" dbtype="odbc">
      SELECT catid,category
      FROM cats
</cfquery>
<!--- initialize the category list --->
<cfset cats="">
<!--- initialize the counter --->
<cfset count=0>
<!--- loop through the categories query --->
<cfloop query="get_cats">
      <!--- append the category to the category list --->
      <cfset cats=ListAppend(cats,category,"|")>
      <!--- now query to get the sub categories and url links --->
      <cfquery datasource="flashmenu" name="get_subcats" dbtype="odbc">
            SELECT subcategory,url
            FROM subcats
            WHERE catid=#catid#
      </cfquery>
      <!--- initialize the subcats list --->
      <cfset subcats="">
      <!--- initialize the urls list --->
      <cfset urls="">
            <!--- create another loop for the subcategories --->
            <cfloop query="get_subcats">
                  <cfset subcats=ListAppend(subcats,subcategory,"|")>
                  <cfset urls=ListAppend(urls,url,"|")>
            </cfloop>
      <!--- output the subcats and the urls --->
      <cfoutput>
            &subcats#count#=#subcats#&urls#count#=#urls#
      </cfoutput>
      <cfset count=count+1>
</cfloop>
<!--- output the cats --->
<cfoutput>
      &cats=#cats#&loaded=1&
</cfoutput>


And here's the flash actionscript that builds the menu:

data_var = new LoadVars();
data_var.path = this;
data_var.onLoad = function(ok)
{
    if(ok){
         this.path.menuGeneration(this);
    } else {
         trace("CFM PAGE MISSING");    
     }
};

function menuGeneration()
{
    var startY = 1, depth = 0;
    var temp = data_var.cats.split("|");
     
    // Set Font Styles
      // textFont is embedded Futura Md BT from Flash
      // Verdana is rendered as html font
      // new TextFormat(font, size, color, bold, italic, underline, url, target, align, leftMargin, rightMargin, indent, leading)
    var style1_fmt = new TextFormat("textFont", 14, 0x000000, false, false, false, "", "", "center");
    var style2_fmt = new TextFormat("Verdana", 12, 0x000000, true, false, false, "", "", "left", "3", "5", "");
    for(var i = 0; i < temp.length; i++){
          // Set a spacer in between categories
              if(depth > 0){
               startY += 50;
               trace("ADDED 50 SPACER")
          }
         // Create empty movieclip and set the depth
             var mc = this.createEmptyMovieClip("main" + depth, depth);
         depth++;
         // Set Stroke Color and Opacity
             mc.lineStyle(1, 0x912211, 100);
         // Set Fill Color and Opacity
             mc.beginFill(0xEDD593, 100);
         // Draw a box
             mc.lineTo(198, 0);     mc.lineTo(198, 20);     mc.lineTo(0, 20);     mc.lineTo(0, 0);
         // Stop fill
             mc.endFill();
         // Create text box
             mc.createTextField("text_txt", 1, 0, 0, 198, 20); //name, depth, x, y, width, height
         // Text box parameters
             mc.text_txt.selectable = false;
         mc.text_txt.embedFonts = true;
         mc.text_txt.text = temp[i];
         mc.text_txt.setTextFormat(style1_fmt);
         mc._x = 1;     mc._y = startY;
         startY += mc._height + 1;
         var subText = data_var["subcats" + i].split("|");
         var subLink = data_var["urls" + i].split("|");
         for(var j = 0; j < subText.length; j++){
              var sc = this.createEmptyMovieClip("sub" + depth, depth);
              depth++;
              sc.createTextField("text_txt", 3, 0, 1, 198, 20);  //name, depth, x, y, width, height
              sc.text_txt.multiline = true;
              sc.text_txt.wordWrap = true;
              sc.text_txt.autoSize = "left";
              sc.text_txt.selectable = false;
              sc.text_txt.embedFonts = false;
              sc.text_txt.text = subText[j];
              sc.text_txt.setTextFormat(style2_fmt);
              var hgt = sc.text_txt._height + 2 > 20 ? sc.text_txt._height + 2 : 20;
              sc.lineStyle(1, 0x912211, 100);
              sc.lineTo(198, 0);     sc.lineTo(198, hgt);     sc.lineTo(0, hgt);     sc.lineTo(0, 0);
              sc._x = 1;     sc._y = startY;
              startY += sc._height + 1;
              var lc = sc.createEmptyMovieClip("click_btn", 2);
              lc._x = lc._y = 1;
              lc.lineStyle(0, 0, 0);
              lc.beginFill(0xEDD593, 100);
              lc.lineTo(197, 0);     lc.lineTo(197, hgt - 1);     lc.lineTo(0, hgt - 1);     lc.lineTo(0, 0);
              lc.endFill();     lc._alpha = 0;
              lc.link = subLink[j];
              lc.onRollOver = function()     {     this._alpha = 100;               };
              lc.onRollOut = lc.onDragOut = function()     {     this._alpha = 0;               };
              lc.onPress = lc.onDragOver = function()     {     this._alpha = 100;               };
              lc.onRelease = function()          {     this.getURL(this.link);          };
         }
    }
    delete data_var;
}
data_var.load("/wboe/flash/right_nav/dsp_menu_categories.cfm");
[+][-]11/16/03 09:30 PM, ID: 9761607Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: ColdFusion Application Server
Tags: flash, set, width
Sign Up Now!
Solution Provided By: hart
Participating Experts: 2
Solution Grade: A
 
[+][-]11/16/03 09:32 PM, ID: 9761612Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/16/03 09:32 PM, ID: 9761613Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/17/03 12:44 AM, ID: 9762234Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/17/03 01:04 AM, ID: 9762298Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/17/03 08:39 PM, ID: 9768917Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81