Skip to main content
Inspiring
June 26, 2006
Answered

V2 Components

  • June 26, 2006
  • 11 replies
  • 2165 views
i have been using the template downloaded from adobe but I receive following error

**Error** C:\work\Incubis\developement\Building.as: Line 43: There is no property with the name 'bB'.
bB = createObject("bBase", "bB", this.getNextHighestDepth());

**Error** C:\work\Incubis\developement\Building.as: Line 44: There is no property with the name 'bB'.
bB._x = 0;

**Error** C:\work\Incubis\developement\Building.as: Line 45: There is no property with the name 'bB'.
bB._y = 0;

Total ActionScript Errors: 3 Reported Errors: 3

title: undefined
files are here BuildingComponents.zip
This topic has been closed for replies.
Correct answer FlashAmit
It works now. I am thru with this components. Now I have to integrate this and make a new component. Will get back to you soon...if face any issues related to the integration...

Thanks Again.

11 replies

FlashAmitAuthorCorrect answer
Inspiring
July 12, 2006
It works now. I am thru with this components. Now I have to integrate this and make a new component. Will get back to you soon...if face any issues related to the integration...

Thanks Again.
Inspiring
July 12, 2006
You're welcome.
FlashAmitAuthor
Inspiring
July 13, 2006
I am back with some more questions...


- How should I write following line if I want to call the function with a parameter
btn.onRollOver = myFunction(param);

- In my class Building when I call function popDownBuilding() and popUpBuilding() internally (Line 59,60) it does not work. In fact it does not have the value of 'floors' inside the function.
After putting a instance on the Stage say instance name "a" and calling the above two functions as
a.popDownBuilding();
a.popUpBuilding();
Works well. What shud I modify to work correctly both way.


Latest Code
Inspiring
July 11, 2006
Upload the latest code with the text field. Saves me some time.
FlashAmitAuthor
Inspiring
July 12, 2006
I was trying this in aseparate file.


Code is here....
FlashAmitAuthor
Inspiring
July 11, 2006
It works all fine. Now I want a text banner along the 30degree line of floors movieclip. I added atext field in the movie clip. But as I skew its text disappear. If I trace the text it is there.
I think it has to be done using the Bitmap class and Matrix class. First converting the text to bitmap text and then applying the tranformations.
But I am not getting a way to do this....
FlashAmitAuthor
Inspiring
July 10, 2006
The function animates but does not hides the movie clips.
Please help to find the errors...
//fName array stores references to the building floor movie clips
public function popDownBuilding() {
for (var i = 0; i<=floors; i++) {
var myTween:Tween = new Tween(fName , "_y", Elastic.easeOut, fName._y, 0, 20, false);
}
myTween.onMotionStopped= function() {
fName ._visible = false;
};
}
Inspiring
July 11, 2006
Remember to attach the code. Now I don't see the array index parameter and instead the code shows up partly italic. Try the attached code. Will probably fail (only one mc set to invisible) so you probably need to setup a seperate function to hide the mc's.



FlashAmitAuthor
Inspiring
July 11, 2006
I am doing the same way but it appears the myTween.onMotionStopped is not executing

Entire code is uploaded...

Download Code
FlashAmitAuthor
Inspiring
July 3, 2006
See in Flash 8 Help> MovieClip Twening Prototypes> Intructions> Additional Notes.
But there is a confusion that is for Flash MX 2004.

Inspiring
July 3, 2006
Couldn't find that topic. Well, the syntax for a tween using the Tween Class would be:

var myTween:Object=new Tween(bBase, "_y", Elastic.easeOut,bBase.targety,[new value],3,true);
or:
var myTween:Tween=new Tween(bBase, "_y", Elastic.easeOut,bBase.targety,[new value],3,true);
if you are targeting > Flash Player 8 (difference in datatype Object/Tween)

where [new value] should be replaced...
FlashAmitAuthor
Inspiring
July 3, 2006
The topic html is lying in my PC at
E:\Documents and Settings\amit\Local Settings\Application Data\Macromedia\Flash 8\en\Configuration\HelpPanel\Help\MovieclipTweening
'E' is my root drive

The content i have uploaded here.
FlashAmitAuthor
Inspiring
July 1, 2006
Thank you very much. So far i have been finding every thing going on the track.

Now I am using Tween Class.

I included

import mx.transitions.Tween;
import mx.transitions.easing.*;

Replaced the MovieClip.as as described in the help.
then added

for (var i = 1; i<=floors; i++) {
//code...
bBase.targety = gFloor._y-gFloorHeight-((i-2)*floorHeight);
bBase.tween("_y", bBase.targety, 3, "easeOutElastic");

The targety value is coming out as expected.
but its not tweening.....
Inspiring
July 2, 2006
>>Replaced the MovieClip.as as described in the help.
Please indicate where you have read that.
FlashAmitAuthor
Inspiring
July 1, 2006
Now how should I refer to 'fName'

class Building extends MovieClip {
[Inspectable]
private var floors:Number;
private var fName:Array;

//code.............
public function createBuilding():Void {
var thisObj:Building=this;
//code
//in the bBase.onRollOver
trace("in>"+thisObj.fName.length);
Inspiring
July 1, 2006
You didn't initialize the array.
Either in init or in createBuilding:
fName=new Array();
then your code:
trace("in>"+thisObj.fName.length)
is correct.
FlashAmitAuthor
Inspiring
July 1, 2006
Please see for loop has access to 'floors' but not available in the 'trace'

public function createBuilding():Void {
// code.....
for (var i = 1; i<=floors; i++) {
bBase = attachMovie("bFloor", "bB"+i, this.getNextHighestDepth());
// code.....
bBase.onLoad = function() {
trace(floors);
}
}
Inspiring
July 1, 2006
Because the trace is in the onRollOver floors is out of scope. Try the local reference.
Inspiring
July 1, 2006
public function createBuilding():Void {
var thisObj:Building=this;
//code
//in the bBase.onRollOver
trace(this._name+">"+(int(this._name.charAt(this._name.length-1))+1)+">"+thisObj.floors);
FlashAmitAuthor
Inspiring
July 1, 2006
on Rollover to the 'bFloor' MCs
trace(this._name+">"+(int(this._name.charAt(this._name.length-1))+1)+">"+floors);
returns

bB1>2>undefined
I have tried this.floors. Even then result is same
Inspiring
July 1, 2006
floors is out of scope there. Use a local reference to the class in createBuilding() to access floors.
FlashAmitAuthor
Inspiring
June 27, 2006
Thanks for your help. This is solved by replacing with 'attachMovie'.

Now need to make a loop and attach a number of Movie Clips. The number of instances will be passed as argument to the class. I am not getting how to start. Where and how to declare instances.
i thought of
for (var i = 1; i<10; i++) {
this["floor"+i] = attachMovie("bFloor", "floor"+i, this.getNextHighestDepth());
this["floor"+i]._x = xCor;
this["floor"+i]._y = yCor-bB._height-gFloor._height-((i-1)*floorHeight);
}

but Nothing was declared earlier.
Please suggest....
Inspiring
June 27, 2006
>>The number of instances will be passed as argument to the class
Then you should start with declaring an inspectable:
[Inspectable] private var floors:Number;
so the number of floors will appear in the component definition dialog box as a component parameter.
Then you can use the number in the loop (just as an example)
public function createBuilding():Void {
for(var i=0;i<floors;i++){
bBase = attachMovie("bBase", "bB"+i, this.getNextHighestDepth());
bBase._x = xCor;
bBase._y = yCor-bB._height-gFloor._height-((i-1)*floorHeight);
size();
}
}
FlashAmitAuthor
Inspiring
June 27, 2006
This works perfectly.

Now i have made the floor as animated. So as it plays to increse its height.
i want as its height increses the floors above it shift simultaneously.

I tried this

bBase.onRollOver = function() {
trace(this);
this.gotoAndPlay(2);
for (var j = int(this._name.charAt(this._name.length)); j<floors; j++) {
this["bB"+j]._y -= 12;
}
};
};

Please help. Latest Files are here.