Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6986477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:48:50+00:00 2026-05-27T18:48:50+00:00

I’m working on my first real Flex app and i have learned a lot

  • 0

I’m working on my first real Flex app and i have learned a lot by it. Now I’m trying to understand the basics of working with classes. I have a function that asks information from the LastFm API. This is the base function:

        public function zoekChart(event:MouseEvent):void
        {
            var api_URL:String = 'http://ws.audioscrobbler.com/2.0/';
            var api_method:String = 'geo.getMetroUniqueArtistChart';
            var api_key:String = '99f1f497c0bd598f1ec20571a38e2219';
            var country:String = countryText.text;
            var metro:String = metroText.text;
            var limit:String = '5'; 
            api_request = api_URL + '?method=' + api_method + '&country=' + country + '&metro=' + metro + '&api_key=' + api_key + '&limit=' + limit;
            myRequest.send();
        }

Now I’m trying to make a class which does the same as the function. This is what i have so far:

package valueObjects
{
public class Kevin_myChart
{
    private var api_URL:String;
    private var api_method:String;
    private var api_key:String;
    private var country:String;
    private var metro:String;
    private var limit:String;

        public function lastFMCall (api_URL:String, api_method:String, api_key:String, 
                                     country:String, metro:String, limit:String) 
        {
            this.api_URL=api_URL;
            this.api_method=api_method;
            this.api_key=api_key;
            this.country=country;
            this.metro=metro;
            this.limit=limit;
        }

        public function getInfo(size:String):String 
        {

            return api_URL + '?method=' + api_method + '&country=' + country + '&metro=' + metro + '&api_key=' + api_key + '&limit=' + limit;

        }   
}

}

Is this a good start? My first question is how i can import the values of textfields countryText and metroText in the class.

Also, how should I continue from here? How can i make sure that my application will be able to use the functions declared in the class and how can i get values in the class’s vars now?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:48:50+00:00Added an answer on May 27, 2026 at 6:48 pm

    You can use your class’s constructor to pass the values. A constructor is called when you create a new instance of your class.

    public function zoekChart(event:MouseEvent):void
    {
        var api_URL:String = 'http://ws.audioscrobbler.com/2.0/';
        var api_method:String = 'geo.getMetroUniqueArtistChart';
        var api_key:String = '99f1f497c0bd598f1ec20571a38e2219';
        var country:String = countryText.text;
        var metro:String = metroText.text;
        var limit:String = '5'; 
    
        // create a new instance of your class
        var kevinMyChart:Kevin_myChart = new Kevin_myChart(api_URL, api_method, api_key:, country, metro, limit);
    
        // not sure what the 'size' is used for
        api_request = kevinMyChart.getInfo("size");
        myRequest.send();
    }
    

    Your Kevin_myChart class with constructor:

    package valueObjects
    {
        public class Kevin_myChart
        {
            private var api_URL:String;
            private var api_method:String;
            private var api_key:String;
            private var country:String;
            private var metro:String;
            private var limit:String;
    
            public function Kevin_myChart(api_URL:String, api_method:String, api_key:String, country:String, metro:String, limit:String) 
            {
                this.api_URL=api_URL;
                this.api_method=api_method;
                this.api_key=api_key;
                this.country=country;
                this.metro=metro;
                this.limit=limit;
            }
    
            public function getInfo(size:String) : String 
            {
                // not sure what the 'size' is used for    
                return api_URL + '?method=' + api_method + '&country=' + country + '&metro=' + metro + '&api_key=' + api_key + '&limit=' + limit;
    
            }   
        }
    }
    

    Your getting in the right direction, maybe this tutorial will give you some more info about the way a class is build.

    http://www.kirupa.com/developer/as3/classes_as3_pg3.htm

    Otherwise a quick Google Search could help you further aswell.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I am trying to loop through a bunch of documents I have to put
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.