# Access constructor parameters from another function

**URL:** https://forum.kirupa.com/t/access-constructor-parameters-from-another-function/318865
**Category:** flash
**Created:** [February 2, 2011, 2:51am UTC](https://forum.kirupa.com/t/access-constructor-parameters-from-another-function/318865 "2011-02-02T02:51:14Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pier25](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pier25](https://forum.kirupa.com/u/Pier25)
#### Post date: [February 2, 2011, 2:51am UTC](https://forum.kirupa.com/t/access-constructor-parameters-from-another-function/318865/1 "2011-02-02T02:51:14Z")

</div>

So I usually use an object in the constructor to receive the parameters like new Class({param1:00,param2:0099,etc).

To be able to access those parameters from other functions inside the class I create an object, and copy it:

```auto

public class MyClass {
	var params = {};
	
	public function MyClass(p){
		params = p;
	}
	
	public function myFunction():void {
		trace(params.myVar);
	}
}

```

Is there a more elegant way to do this?
