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 7714079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:02:12+00:00 2026-06-01T02:02:12+00:00

I have my main stage, and I have two objects (blocks), these two objects

  • 0

I have my main stage, and I have two objects (blocks), these two objects both extend from the “Block” class. The “Block” class is NOT extended from the Main Class.

I would LIKE to call a function, in either the “Block” class or in it’s subclasses, from the Main Stage Class. The functions will do slightly different things depending which object you are calling the function (Added different things, and different number of things to an array). What is the best way to implement this?

I am sorry I have no code to show right now, I am just attempting to sit down and do it now but feel quite lost.

  • 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-06-01T02:02:13+00:00Added an answer on June 1, 2026 at 2:02 am

    Not quite sure I follow so I’m going to assume you mean this.

    You have a class called Block

    You create two of these Block’s and store them, possibly in an array from your base class.

    //stage base class
    var blockArray:Array = new Array()
    
    private function createBlocks():void{
    
        var blockOne:Block = new Block(1); //passing in an int to block, could be anything but this 
                                           // will be used to do slightly different things
    
        var blockTwo:Block = new Block(2);
        blockArray.push(blockOne...blockTwo)
    }
    

    Now in your block class

    //block class
    class Block{
       var somethingDifferent:int; //this is where we will store the int you pass in when the blocks are made
       public function Block(aInt:int){
           somethingDifferent = aInt //grabbing the int
       }
    
       public function doSomething():void{
           trace(somethingDifferent); //will trace out the number passed
       }
    
    }
    

    Now back in your main class

    //stage base class
    private function doSomethingToBlocks():void{
        //lets call doSomething on each block
        Block(blockArray[0]).doSomething() //this will trace 1 because we passed that into the block in our array slot 0
        Block(blockArray[1]).doSomething() //this will trace 2
    }
    

    Hopefully this is what you’re after

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

Sidebar

Related Questions

I have 2 classes within same package. Both classes have main method in them.
I have a main window (#1) on my webpage from which I open a
I have a main table that I must get data from. I have a
My project have two main requirements 1) Different set of rules applied to same
I have my main Activity with two Buttons on it. When I start the
I have the following two classes: package { import flash.display.Sprite; import flash.events.Event; public class
I have two flash files (say screenOne.fla and gameA.fla). After importing the main symbol
I have these two pieces of code that could possibly be run at the
I'm making an iPhone game in which I have two main views, the planning
I have a reasonably simple split view application adapted from iPhone code. The main

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.