Quantcast
Channel: Adobe Community : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 238792

External as question

$
0
0

Gidday

 

Biting the bullet and learning OOP.

 

I'm trying to use an external as file to create a countries combobox. 

 

At first, I managed to create an object array of countries, and populate a combox box I made in the IDE:

 

EXTERNAL AS:

 

package com {   

 

    import fl.data.DataProvider;

    import fl.controls.ComboBox;  

 

    public class countries

 

    {

          public var countryDP:Array = new Array({label:"United States", c:"US"},{label:"United Kingdom", c:"UK"}...

 

On my timeline:

 

import com.countries;

var add_country_comboBox:countries = new countries();

countryCB.dataProvider = new DataProvider(countryDP.countryDP);

 

...which worked.

 

Now I'd like to adda function within  the class to create the comboBox in the class, and use the timeline to instantiate it and tell it where to be placed...

 

public function add_country_CB(x,y):void{

 

var cb:ComboBox = new ComboBox();

  var dp:DataProvider=new DataProvider(countryDP);

cb.dataProvider=dp;

cb.labelField="Countries";

cb.x=x;

cb.y=y;

  stage.addChild(cb);

}

 

 

But I'm not cracking how you call that from the timeline to make the combobox appear:

 

import com.countries;

var add_country_comboBox:countries = new countries();

(what goes here?)

 

Thanks for your help.


Viewing all articles
Browse latest Browse all 238792


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>