Announcement Announcement Module
No announcement yet.
Referencing items in flash. warning long post. Page Title Module
Move Remove Collapse
Search Search Module

Advertisement Advertisement Module

Latest Topics Latest Topics Module

  • Designia
    Reply to Indesign Advice Please
    That's just the nature of the beast, it's kinda your job. The.csv file should be proofed and signed off on before you even look at it.
    Today, 06:07 PM
  • Designia
    Reply to Japan scraps Olympic logo over plagiarism allegation
    Whoa! But I seriously DO NOT get it for the Tokyo Olympics. What is it supposed to be? I get the Theatre logo.
    Today, 06:06 PM
  • DZNiris
    Reply to Indesign Advice Please
    Maybe a pdf extraction is an option. My main concern is each time the data merge process is done it is open to mistakes and the files have to go through a proofing process again and I want to avoid t...
    Today, 06:03 PM
  • Designia
    Reply to Indesign Advice Please
    Use a Romanian dictionary too.
    Today, 06:02 PM
  • DZNiris
    Reply to Indesign Advice Please
    Ya your right HotButton. I was hoping for an easy solution to this without having to do a data merge every time there is a new order....
    Today, 06:02 PM

Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Referencing items in flash. warning long post.

    Hello again. im making a website to showcase my portfolio, and so far it's going ok. There are some things that I need help with, technical issues because I'm just learning to use flash properly. If you can help thanks sooo much, otherwise just check back on the site periodically and give me feed back. I'll post the Action Script and the XML i have, for reference. I know you are all primarily print designers, but if there is a web guru in here that'd be great! Again, it's a long list of stuff, all of which I'm trying to make happen, if you can help out with one great, multiple items splendid.

    my site is at

    what I would like to do is:

    1. Find out how to place my flash animation in the middle of the browser window, not matter how big or small it gets.
    2. How to determine the size of the browser window when it opens.
    3. How to specify a minimum width and height of the browser window.
    a good example of what I would like to achieve is at after entering the site.
    4. In terms of modifying my site: how to get the menu bars to have different colors/patterns.
    5. how to change the colors of the fonts in the menu bars.

    #4 is hard for me because the way I have the coding set up is that I have a movie clip in flash that is referenced upon every occurrence of its name in action script. It's the same image/clip with a dynamic text box in order to change the title for the different instances its used in. The dynamic text thing is the same, if I change the color in flash it will be changed for all 4 bars, but I would like them to each be different colors (cmyk probably).
    //import tweenlite classes
    import gs.TweenLite;
    import gs.easing.*;

    var MENU_ARRAY:Array; //used to save the items data
    var OPENED_MENU:int; //to inform the menu that should be open at startup
    var MOVE_ON_MOUSE_OVER:Boolean=false; //tha name says everything
    var xmlLoader:URLLoader; //the xml loader

    loadXML("menu.xml"); //load the xml

    function loadXML(Uri:String):void {
    xmlLoader = new URLLoader();
    xmlLoader.addEventListener(Event.COMPLETE, onComplete);
    xmlLoader.addEventListener(IOErrorEvent.IO_ERROR, onError);
    xmlLoader.load(new URLRequest(Uri));

    function onError(evt:ErrorEvent):void {
    trace("cannot load xml file");

    function onComplete(evt:Event):void {
    //read and load xml into array, by parsing it using prepareMenu
    placeItemsOnStage(); //place all required items on stage.

    function placeItemsOnStage():void {
    var pos:Number=0;
    //define the container properties

    for(var c:int=0; c<MENU_ARRAY.length; c++) {
    var it:menuItem = new menuItem; //load out menuItem, because its exported to AS, we can use it here
    it.x=c*25; //its the gray border width
    it.y=0; //place on top"Item-"+c; //id the menuItem"Item-"+c; //name de menuItem
    it.posX=pos; //actual pos, useful to open and know is position
    it.itemLabel.text=String(MENU_ARRAY[c].Ititle).toUpperCase(); //load the label in uppercase
    it.addEventListener(MouseEvent.CLICK, onMouseClick); //add mouse click listener
    if(MOVE_ON_MOUSE_OVER==true) it.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver); //if configured, load the mouse over event
    it.useHandCursor=false; //use hand cursor
    it.buttonMode=true; //buttonMode
    it.itemText.visible=false; //hide the textField
    menuContainer.addChild(it); //add the menu item as child

    if(String(MENU_ARRAY[c].IcontentType)=="image/swf") { //check the content and load things accordint to it
    var ldr:Loader = new Loader();
    ldr.load(new URLRequest(MENU_ARRAY[c].IcontentData.toString()));
    else if(String(MENU_ARRAY[c].IcontentType)=="text") {
    pos+=25; //the next menuItem x position

    //put mask in place

    moveItem(OPENED_MENU-1); //open menu confirured in XML


    function onMouseOver(evt:MouseEvent):void {
    if("buttonBack") prepareMove(evt)

    function prepareMove(evt:MouseEvent):void {
    var targetName:String =; //get the menuItem
    var temp:Array = targetName.split("-"); //split his name: Item-x
    var itemNumber:int=(temp[1]); //got item number
    moveItem(itemNumber); //move it

    function onMouseClick(evt:MouseEvent):void {
    if("buttonBack") prepareMove(evt); //mouse action was done in buttonBack
    else trace("Item "" clicked!"); //mouse action was made on accordion area

    function moveItem(num:int):void {
    var itemToMove:menuItem=menuContainer.getChildByName(" Item-"+String(num)) as menuItem;
    //get the menuItem child
    for(var m=0;m<MENU_ARRAY.length;m++) //move one-by-one to the new position
    var tempMc = menuContainer.getChildByName("Item-"+m);
    if(tempMc.x > itemToMove.x), 1, {x(tempMc.posX) + itemToMove.width-138), ease:Quart.easeOut}); //see tweenLite for info about this.
    else if(tempMc.x <= itemToMove.x), 1, {xtempMc.posX), ease:Quart.easeOut});

    function prepareMenu (XMLData:String):Array
    //make sure it cames in XML
    var menuXML:XML = new XML(XMLData);
    //just in case
    menuXML.ignoreWhitespace = true;

    //get XML item's entrys
    var XMLItems = menuXML.descendants("item");

    //load all items into an array
    var itemsArray:Array = new Array();
    var itemObj:Object;
    for(var i in XMLItems)
    itemObj=new Object();
    OPENED_MENU=menuXML.@menuOpen; //get menu for open.
    MOVE_ON_MOUSE_OVER=(menuXML.@moveOnMouseOver.toStr ing()=="true" ? true : false); //get the option for load or not mouseOver open
    return itemsArray;


    here is the action script and xml. if you would like me to post the html file that flash publishes just let me know.
    <?xml version="1.0" encoding="utf-8"?>
    <menu menuOpen="1" moveOnMouseOver="false">

    <item Ititle="Home" IcontentType="text" IcontentData="Hello and welcome to my website. As you can see, it is currently under construction, but is scheduled to be completed by May '10. Please visit again to see changes and updates."/>

    <item Ititle="PORTFOLIO" IcontentType="text" IcontentData="Custom Text"/>

    <item Ititle="PHOTOGRAPHY" IcontentType="image/swf" IcontentData="space_gallery.swf"/>

    <item Ititle="RESUME" IcontentType="image/swf" IcontentData="image4.jpg"/>

    <item Ititle="CONTACT" IcontentType="image/swf" IcontentData="image2.jpg"/>


    Thanks for looking at this guys, i know it can be a pretty daunting task to deal with coding.
Mediabistro A division of Prometheus Global Media home | site map | advertising/sponsorships | careers | contact us | help courses | browse jobs | freelancers | content | member benefits | reprints & permissions terms of use | privacy policy Copyright © 2015 Mediabistro Inc.