Wrox Programmer Forums
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Flash (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2005, 11:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default get dynamic onMouseDown to work

Can somebody help me with this. I have a file that pulls a list of states
(I am only working with Idaho right now) and loads the names into my flash movie. Everything works til it gets to the this.onMouseDown = function(). For some
reason I cannot get it to activate the state any ideas?

var StatesList:LoadVars = new LoadVars();
StatesList.load("stateListings.asp");
var Idaho_x:Number = 94.9;
var Idaho_y:Number = 21.9;

this.createTextField("StatesText", 500, 150, 80, 300, 40);
StatesList.onLoad = function() {
    var arrStates:Array = new Array(StatesList.strStates);
    for(var i:Number=0;i<=arrStates.length-1;++i){
        var currButton = attachMovie(arrStates[i], arrStates[i], i+2);
        currButton._x = eval(arrStates[i] + "_x");
        currButton._y = eval(arrStates[i] + "_y");
        var newColor:Color = new Color(currButton);
        newColor.setRGB(0xE1E2E3);
        StatesText.text = arrStates[i];

//From here on down is the section that will not work.
        currButton.onMouseDown = function(){
            ActivateState(arrStates[i]);
        }
    }
}

function ActivateState(thisState){
        var currColor:Color = new Color(thisState);
        if (currColor.getRGB() == 0xFBE600) {
//Change the state color to Gray
            currColor.setRGB(0xE1E2E3);
                             //more processing code to come later
        } else {
//Change the state color to Yellow
            currColor.setRGB(0xFBE600);
                             //more processing code to come later
        }
};

you can see the working code
http://www.ivievendors.com/problemchild/states2.html

Many Thanks
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
help writing dynamic form data to dynamic table ublend SQL Server ASP 1 June 1st, 2007 08:09 AM
help writing dynamic form data to dynamic table ublend Classic ASP Professional 1 June 1st, 2007 08:08 AM
Dynamic Columns & Dynamic Grouping ??? nileshgambhava SQL Server 2005 0 December 12th, 2006 12:45 AM
Combo box can not work with dynamic Range dahlia492 Excel VBA 1 November 20th, 2006 12:43 PM
Dynamic Checkboxes using dynamic Select Values bsheridan Classic ASP Databases 0 March 12th, 2006 10:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.