Resizing swf dynamically

Hi Guys,
          I am uploading different size of images dynamically but at the same time I want the stage to be resized accordingly to image's height and width.
What is the best way to do it?

In the following Actionscript I am passing image's(which is on stage) width and height to the Javascript:-
stagewidth = 400 stageHeight = 300
imageWidht = 540 stageHeight = 544
import flash.external.ExternalInterface;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
var data1 = 10;
var data2 = 20;
var divid = "flashid";
trace("clip dimensions : "+clip_mc.width+" "+clip_mc.height);
ExternalInterface.call("setFlashHeight", divid,clip_mc.height);
ExternalInterface.call("setFlashWidth", divid,clip_mc.width);
HTML Code:-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>resizeStage2</title>
<script language="JavaScript" type="text/javascript">
<!--
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2008 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
function ControlVersion()
    var version;
    var axo;
    var e;
    // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
    try {
        // version will be set for 7.X or greater players
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
        version = axo.GetVariable("$version");
    } catch (e) {
    if (!version)
        try {
            // version will be set for 6.X players only
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
            // installed player is some revision of 6.0
            // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
            // so we have to be careful.
            // default to the first public version
            version = "WIN 6,0,21,0";
            // throws if AllowScripAccess does not exist (introduced in 6.0r47)       
            axo.AllowScriptAccess = "always";
            // safe to call for 6.0r47 or greater
            version = axo.GetVariable("$version");
        } catch (e) {
    if (!version)
        try {
            // version will be set for 4.X or 5.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
            version = axo.GetVariable("$version");
        } catch (e) {
    if (!version)
        try {
            // version will be set for 3.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
            version = "WIN 3,0,18,0";
        } catch (e) {
    if (!version)
        try {
            // version will be set for 2.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
            version = "WIN 2,0,0,11";
        } catch (e) {
            version = -1;
    return version;
// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
    // NS/Opera version >= 3 check for Flash plugin in plugin array
    var flashVer = -1;
    if (navigator.plugins != null && navigator.plugins.length > 0) {
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
            var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
            var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
            var descArray = flashDescription.split(" ");
            var tempArrayMajor = descArray[2].split(".");           
            var versionMajor = tempArrayMajor[0];
            var versionMinor = tempArrayMajor[1];
            var versionRevision = descArray[3];
            if (versionRevision == "") {
                versionRevision = descArray[4];
            if (versionRevision[0] == "d") {
                versionRevision = versionRevision.substring(1);
            } else if (versionRevision[0] == "r") {
                versionRevision = versionRevision.substring(1);
                if (versionRevision.indexOf("d") > 0) {
                    versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
            var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
    // MSN/WebTV 2.6 supports Flash 4
    else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
    // WebTV 2.5 supports Flash 3
    else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
    // older WebTV supports Flash 2
    else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
    else if ( isIE && isWin && !isOpera ) {
        flashVer = ControlVersion();
    return flashVer;
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
    versionStr = GetSwfVer();
    if (versionStr == -1 ) {
        return false;
    } else if (versionStr != 0) {
        if(isIE && isWin && !isOpera) {
            // Given "WIN 2,0,0,11"
            tempArray         = versionStr.split(" ");     // ["WIN", "2,0,0,11"]
            tempString        = tempArray[1];            // "2,0,0,11"
            versionArray      = tempString.split(",");    // ['2', '0', '0', '11']
        } else {
            versionArray      = versionStr.split(".");
        var versionMajor      = versionArray[0];
        var versionMinor      = versionArray[1];
        var versionRevision   = versionArray[2];
            // is the major.revision >= requested major.revision AND the minor version >= requested minor
        if (versionMajor > parseFloat(reqMajorVer)) {
            return true;
        } else if (versionMajor == parseFloat(reqMajorVer)) {
            if (versionMinor > parseFloat(reqMinorVer))
                return true;
            else if (versionMinor == parseFloat(reqMinorVer)) {
                if (versionRevision >= parseFloat(reqRevision))
                    return true;
        return false;
function AC_AddExtension(src, ext)
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
function AC_Generateobj(objAttrs, params, embedAttrs)
  var str = '';
  if (isIE && isWin && !isOpera)
    str += '<object ';
    for (var i in objAttrs)
      str += i + '="' + objAttrs[i] + '" ';
    str += '>';
    for (var i in params)
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    str += '</object>';
  else
    str += '<embed ';
    for (var i in embedAttrs)
      str += i + '="' + embedAttrs[i] + '" ';
    str += '> </embed>';
  document.write(str);
function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
function AC_SW_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();   
    switch (currArg){   
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":   
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
function setFlashWidth(id,data2){
        alert("newW  : "+data2);
        document.getElementById(id).style.width = data2+"px";       
function setFlashHeight(id,data1){
        alert("newW  : "+data1);
        document.getElementById(id).style.width = data1+"px";       
// -->
</script>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet-->
<div align="left">
    <div id="flashid">
        <script type="text/javascript" language="JavaScript">
            //e = canResizeFlash();
            document.write('<object data="resizeStage2.swf" width="100%" height="100%" type="application/x-shockwave-flash">');
            document.write('<param name="movie" value="resizeStage2.swf" />');
            //document.write('<param name="FlashVars" value="allowResize='+e+'" />');
            document.write('Flash Movie With Resizing Content');
            document.write('</object>');
        </script>
        <noscript>Javascript must be enabled to view Flash movie</noscript>
    </div>
</div>
<script language="JavaScript" type="text/javascript">
    AC_FL_RunContent(
        'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
        'width', '550',
        'height', '400',
        'src', 'resizeStage2',
        'quality', 'high',
        'pluginspage', 'http://www.adobe.com/go/getflashplayer',
        'align', 'left',
        'play', 'true',
        'loop', 'true',
        'scale', 'showall',
        'wmode', 'window',
        'devicefont', 'false',
        'id', 'resizeStage2',
        'bgcolor', '#ffffff',
        'name', 'resizeStage2',
        'menu', 'true',
        'allowFullScreen', 'false',
        'allowScriptAccess','sameDomain',
        'movie', 'resizeStage2',
        'salign', ''
        ); //end AC code
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="550" height="400" id="resizeStage2" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="resizeStage2.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />    <embed src="resizeStage2.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="resizeStage2" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
    </object>
</noscript>
</body>
</html>
The error messgae I get on the first line of the script: - "null" is null or not an object
Thakn you for your help.

Similar Messages

  • Insert a trademark symblol to my swf dynamicly using XML

    hello there,
    i am trying to insert a trademark symblol to my swf dynamicly
    using XML,
    i tried every thing i could "caved the xml in every format
    known to man kind, wrote some AS script to replace thin join, i
    tried to hard code the symble" but nothing worked.
    i am running flash8.
    help is needed plz.
    today is the DEAD LINE.
    plz.

    Okay, test files are up in the following directory:
    www.saffronthread.com/test
    You can guess which ones are for you. I didn't deal with the
    whole IE stupidness, so you my need to click on the page. But I've
    got several different text fields some runtime some author
    environment and sample text. Works for me on Mac and on the PC I
    checked. Let me know what you find out.
    As for System.useCodePage it is very seldom an actual
    solution to the problem. It is a solution for when you want to be
    sure that the user's Flash Plugin uses the computer's code page for
    text rendering. Read the help entry for it and you will see that it
    is not a solution for making sure that the most people possible
    will correctly receive my text. It is more a solution for, I want
    to make sure that those with Chinese operating systems are able to
    correctly see the Chinese text I have encode with my special
    encoding.
    Most questions that get a "Oh, you must use
    System.useCodePage answer" are more like, "I want to make sure that
    everybody on every type of system can see my special characters."
    The answer for that tends toward proper use of UTF-8 and that is my
    guess for your problem. That your XML file is not being saved as
    UTF-8. If System.useCodePage is helping you that tells me that your
    XML editor is saving to some odd (maybe very popular, but not
    UTF-8) encoding.

  • Help resize  SWF in vertical direction

    I have more reach application, in simplify my problem looks so:
    I dont' need in scroling.
    How do it? With JavaScript? or exists decision in ActionScript 3?
    Help plz.

    Quick google search provided me following have you tried any of these?
    http://forums.adobe.com/thread/689870
    Can the SWF size itself in an HTML page?http://www.flepstudio.org/forum/tutorials/3578-resizing-swf-real-time.html

  • Perplexed about resizing swf to window

    Hi all,
    I cannot change both the width 100% and height 100% of my SWF in the properties panel of DW and have the movie load on my website (it is missing).  I can change the width to 100% and the height to any size (100 to 2000 px) and the movie will fit horizontally all the way across my screen but is either to short or to tall vertically, respectively.
    I can change all kinds of parameters (adding or deleting) and get the same result.  I see a lot of conversation about this in the forums but not a straight forward fix for the non-java types. I have changed alot of info for the tags inculding padding and margin to 0 and height and width to 100%.
    I am using DW CS5.  Any suggestions?
    Thanks,
    Randy

    Hi
    Setting height and width to 100% -
    In some browsers it will work, to some degree, in others it will not without a little JavaScript and/or resizing the page,
    For an example of resizing swf to the page, (try this in various browsers, to see how they differ, and that all do) - http://www.pziecina.com/design/turorial_demos/autoresize_flash.php. View source to see how it is done.
    PZ

  • Can we resize swf file created with AIR API in AIR application?

    Hi,
    I created a .swf file with AIR API.
    I want to open and resize it in AIR application. This .swf file taking dimensions as default in which it opens.
    I want to change its width and height.
    Is there any way to change its dimensions?
    Please suggest me the solution.
    thank you

    Loading a Flex WindowedApplication into another is not supported.  However,
    you might be able to access the WindowedApplication and size it.  Sub-Apps
    in AIR should be based on Application, not WindowedApplication.

  • Resizing Swf at runtime based on content

    Hi I am working on a project and I am trying to figure out how to resize the swf at runtime based on the content (which is brought in by xml) .  What I am trying to do is similar to http://www.mustardlab.com/developer/flash/objectresize/  but unfortunately this is written in AS1 and doesnt help me much!  If anyone could please explain to me how to do this in AS3 I would really appreciate it.  I know I need to use the ExternalInterface but I am very new to AS3 and am not sure how to do this.  I have searched and searched all over the internet and still can't figure it out.  Any source code you might have would be AWESOME!
    Thanks again,
    Kathy

    Hi again:)  I guess that’s the problem, I'm not sure of the code..i mean I guess I understand the basics..i need to call on the textField.height and send it to the javascript via the ExternalInterface..then I'm stuck..how to get the javascript to resize the div which is what I'm assuming it needs to do?  Again, this I'm really new at this and I'm working on a site for a client..I have been struggling to get it to work..i'd dump the flash all together but she reallllllllllly wants it!
    Here is the site if you want to see it.  Its not finished yet but I'm getting there!
    www.daedaldesigns.com/jackiegood/
    Right now the issue is the text on some pages is short and on others is long..so I need to get it to expand.
    Thanks again..I really appreciate your time!
    Kathy

  • SWF & Dynamic Text

    Hi all,
    I'm getting myself a little confused. I think this is so easy
    I am missing it.
    My Flash file contains some dynamic text fields. When I
    publish the Flash file I get the swf, great.
    But, how do I publish the file that contains the dynamic text
    changes?
    THX.

    A couple of guesses are:
    1. If the HTML document you got with the purchased template
    was the same
    name as the movie, then by republishing the Flash movie you
    could have
    overwritten the HTML doc that contains the Javascript. If
    this is the case,
    then you needed to turn of publishing the html
    File->Publish Settings and
    hopefully you have the original copy.
    2. You may not be using the correct HTML file. How are you
    testing? If you
    are using File->Publish Preview as mentioned above Flash
    may be generating
    an HTML document for the testing convenience and you may not
    be using the
    correct HTML with the Javascript in it.
    Lon Hosford
    www.lonhosford.com
    May many happy bits flow your way!
    "DesignBetty" <[email protected]> wrote in
    message
    news:e269d1$pp5$[email protected]..
    Thanks for responding. Please excuse my "neophytness" about
    this. Javascript
    and php seems so easy right now.
    Let me explain a bit clearer.
    I am updating an old template that was purchased (groan).
    The fla file has
    dymanic text boxes. I also have the swf file. And then I have
    another html
    doc
    that stands alone. This html doc allows me to changes the
    variables in the
    swf
    doc.
    Sounds great, huh?
    But I have made a few simple changes in the FLA doc (font,
    position, etc).
    Now
    when I republish it I get a SWF doc that doesn't reference
    the html doc that
    lets me change those variables.
    Am I missing a step?
    thx!

  • DataGrid Not Resizing to Dynamic Content

    Hello,
    I'm using Flex 3.2. I have an editable DataGrid with no with
    and height specified. I do specify rowCount to something like
    rowCount="dataProvider.length". Everything looks good when the
    datagrid is first rendered with data in it. However, if the data in
    it changes after rendering, then the grid doesn't resize
    accordingly. Actually the grid may resize, but the border/frame
    doesn't.
    Example:
    I have a special TextArea component that grows (vertically)
    as the user types in more lines of text. I use this component as
    one of my item editors. If a cell is first rendered with only one
    line of text, then the user goes in and types additional lines, the
    grid row grow within it's border, but the not the border itself...
    causing some undesired scrollbars.
    I need a way to tell the datagrid to re-calibrate sizing just
    like it does when it's first created. Is there a way to do this? I
    tried datagrid.invalidateSize() and related procedures, but nothing
    happens. What do you think?
    Thanks

    "bfargo" <[email protected]> wrote in
    message
    news:gmcsal$34d$[email protected]..
    >I finding this datagrid sizing to be extremely
    frustrating as to say, HTML
    > tables. I just want it to look good. Anytime I do
    anything with dynamic
    > content, it doesn't size right, or I end up with a bunch
    of ugly
    > scrollbars,
    > etc. I just want to be able to add some content, and
    have the datagrid
    > grow
    > with it.. at least in height.
    > VariableRowHeight is set to true, I try setting rowcount
    to my
    > dataprovider
    > length. Event though the length may be 5, it'll randomly
    throw a bunch of
    > other rows in there. The behavior is just completely
    incoherent (at
    > least to
    > me). Nobody else has these problems? .
    Post code

  • Problems resizing SWF to browser

    Hi all,
    I am having trouble making a SWF project resize to full screen.  I am using a third party flash component “Slideshowpro” and I am working with CS5 Flash and CS5 Dreamweaver.
    There is only 1 layer when I open slideshowpro and I have added the following code to the first key by opening “Window>Actions” in Flash:
    import net.slideshowpro.slideshowpro.*;
    stage.align = StageAlign.TOP_LEFT;
    stage.scaleMode = StageScaleMode.NO_SCALE;
    resizeHandler(null);
    function resizeHandler(event:Event) {
         my_ssp.setSize(stage.stageWidth,stage.stageHeight);
    stage.addEventListener(Event.RESIZE, resizeHandler);
    I set my instance name to "my_ssp"
    I also did a similar set up in Flash “Publish Settings” on the HTML tab (W/H 100%, Scale: No scale, Flash Alignment Hor/Left and Vert/Top).
    I also set height and width to 100% in html doc using Dreamweaver.  The site is www.rannallenphotography.com.
    I can only see a truncated version of my SWF movie in IE and only gray background in Firefox?  If I add any px dimension to the horizontal position, the SWF slideshow opens to max width and the horizontal pixel dimension…
    I feel as if I am overlooking something simple being a novice at Flash and DW.
    Any Suggestions?
    Randy

    Not sure how, but by coping code from a website where resizing worked, my website now works and the swf resizes to browser...   Now when I exit from Full Screen it resizes incorrectly, but that (I think) is a flash problem. 
    thanks

  • Resizing swf in Panini

    Hi all,
    I'm doing a project with Panini and I'm stuck with a problem.
    I added a swf slideshow in one state and I want it to resize and always keep its center in the artboard. However, when I check the resize buttons, and I am checking all of the four buttons, horizontal with "center" and vertical "fixed", the swf gets to the left when I resize it, and does not center. Is it possible to make this always centered, at any window size?
    What I am trying to achieve is something like this: http://www.duribeiro.com.br/
    But all I am getting is this:
    What am I doing wrong? Please help! I've tried all kinds of combinations with this buttons - center, fixed, only vertical, only horizontal etc.
    My artboard is 1024/768px, the swf slideshow is 902/600px
    THANKS!

    Hi,
    It is a slideshow pro file I created. Unfortunately, I don't think that is the source of the issue, as the same seems to happen if I drag a flash component to the artboard:
    It's very annoying because it seems to be the most obvious and easy thing to do....
    Thanks.

  • Resizing .swf files

    Hello,
    I recently published two seperate Captivate projects. You can see the work below:
    http://extmedia.kaplan.edu/legal/global/images/Legal_Studies1/Legal_Studies1.swf
    http://extmedia.kaplan.edu/legal/global/images/LSplaybook3/LSplaybook3.swf
    My problem is that one of the files will resize when you drag the browser window, but the other file will not.
    Is there a publishing setting somewhere that i missed?
    Any help is greatly appreaciated!
    Thanks,
    Tom

    Thank you for your quick response.
    I still don't understand why only one of my published projects will resize  . I need both projects to resize because they are being featured in a lightbox and I will need them to stay in a defined size.
    Click on the links. One can scale, the other cannot.
    Thank you,
    Tom

  • Container resizing when dynamically showing/hiding components

    I work with Swing for quite some time, but there's one thing that's bugging me all the time - when you dynamically show/hide some components, the container is not resized appropriately. That means that some components are cut off or hidden beyond the container edge. Maybe I'm just doing something wrong, can somebody help me?
    The easiest example is here. I'll create a label that is hidden by default. When I dynamically show it, the frame/panel is not enlarged and therefore the label is not visible until the user manually resizes the frame/panel. Only after that you can see it.
    (Usually I use the layout manager used when designing UIs in NetBeans, but I hope these default layout managers will demonstrate the same problem.)
    import java.awt.event.*;
    import javax.swing.*;
    public class DynamicComponentDemo {
        private static void createAndShowGUI() {
            final JFrame frame = new JFrame("Dynamic Component Demo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setLocationRelativeTo(null);
            final JPanel panel = new JPanel();
            frame.add(panel);
            final JCheckBox checkbox = new JCheckBox("Show label");
            final JLabel label = new JLabel("This is a label!");
            checkbox.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent e) {
                    label.setVisible(checkbox.isSelected());
            label.setVisible(false);
            panel.add(checkbox);
            panel.add(label);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }What can I do to force the frame/panel to resize appropriately when some new component is shown? Moreover, can you point me to some documentation regarding these matters?
    Thanks.

    Kleopatra wrote:
    no. no. no. no. Never-never-ever call setXXSize - XX for min/pref/max - in application code.Thanks for the correction.
    Unfortunately,
    http://wiki.java.net/bin/view/Javadesktop/SwingLabsImperialRules
    is a dead link, so I'm not sure if this is better than my previous example :(
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DynamicComponentDemo3 {
      private static void createAndShowGUI() {
        final JFrame frame = new JFrame("Dynamic Component Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        final JPanel panel = new JPanel(new FlowLayout() {
          @Override public Dimension preferredLayoutSize(Container target) {
            //synchronized (target.getTreeLock()) {
            Dimension ps = super.preferredLayoutSize(target);
            Dimension cs = target.getSize();
            ps.width  = Math.max(cs.width,  ps.width);
            ps.height = Math.max(cs.height, ps.height);
            return ps;
        frame.add(panel);
        final JCheckBox checkbox = new JCheckBox("Show label");
        final JLabel label = new JLabel("This is a label!");
        checkbox.addItemListener(new ItemListener() {
          public void itemStateChanged(ItemEvent e) {
              label.setVisible(checkbox.isSelected());
              frame.pack();
        panel.add(checkbox);
        panel.add(label);
        frame.pack();
        label.setVisible(false);
        frame.setVisible(true);
      public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            createAndShowGUI();
    }

  • Error loading a swf dynamically

    Hi,
    I am new to flex(using flex 3). This is my first AIR app. here is what i want to achieve:
    1. My AIR app loads a SWF(FP 09) which has action script 3.0 code in it. I useSWFLoader control to load the SWF file.
    2. After loading the SWF, my app reads and changes variables in the loaded SWF file.
    Now the issue which I am running into is:
    1. When i run the app from flex builder(i.e. ctrl + F11) => my app works fine.
    2. BUT WHEN I EXPORT IT AND INSTALL THE APP FROM THE .air INSTALLER AND THEN RUN THE APP => It loads the SWF file(since i can see it) but my loaded swf file does not play at all.
    I suspect SECURITY ISSUES.
    can anyone help me how to resolve this issue. Any help would be highly appreciated.
    Manish

    Get Flex 3.3 and use -target-player=10
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Create SWF dynamically... using Delphi

    Hi guys...
    I'm building a Powerpoint to flash Converter in delphi for
    personal purposes...
    So far, i got the contents of the powerpoint file, but i need
    to create a flash file to attach the slides into it!
    I am using OLE to communicate with the components.
    I want to make this converter available for all users, and
    maybe in the future, release a version with command line support...
    maybe in JAVA
    ok... I have heard about Delphi Flash SDK, but i don't want
    to use that also because that's not free!
    I really need to do it in raw code like i do on Excel, Word
    and Powerpoint automation routines.
    So far the only information i have is how to create the OLE
    object... something similar to this:
    flAPI := CreateOleObject('ShockwaveFlash.ShockwaveFlash.9');
    but after this point... i'm just lost
    I really need some help guys!
    Thanx in advance!

    The swf player must contains play,pause,full screen, volume control options. I need to play swf fomat video tutorials for my site with player controls like flvplayback. But flv playback only supports .flv .. Please help me.... or send me sctionscript for swf player to play swf video files... It will be very usefull to me....
    Thanks,
    veluruga

  • How to resize component dynamically?

    I customized a LCD component extended from JLabel. It has two type of dimension, i.e.
    8x8 and 16x16. When clicking 16x16 button, LCD component should be resized to be 16x16
    by calling setModelSize method. But it doesn't work.
    Please tell me the answer, thank you!
    public void setModelSize(int xCells, int yCells) {
         this.xCells = xCells;
         this.yCells = yCells;
         repaint();
    }

    it also depends on the layout of the container. if the layout is null, then u can easily adjust the size. of course then u have to initialize the position and size of the components first in order to see them.

Maybe you are looking for