Accessing Object Name

For questions about using Classic.

Post » Wed May 30, 2012 2:01 pm

Is it possible to access an object's name?
Like in an expression Object.ObjectName.
There doesn't seem to be a way.

Thank You in advance.
B
3
G
1
Posts: 70
Reputation: 615

Post » Wed May 30, 2012 3:43 pm

An object is already accessed by its name. A Sprite named "bubble" will be accessed in expressions as bubble.someparameter

What's the purpose? It could help making better proposals :)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu May 31, 2012 5:20 am

The purpose is being able to automatically write an object's name within a Family into a variable.

Something like this:

+ If (Family) "Letters" Clicked:
> RecordLetterVar.Add: Letters.ObjectName

Imagine Letters contains objects like A, B, C etc. .
It would be tedious to manually write an 'On Click' Event for every letter object separately.

Of course I know what You said Tulamide, lol; but thank You for being there. :)
B
3
G
1
Posts: 70
Reputation: 615

Post » Thu May 31, 2012 1:42 pm

[QUOTE=Shindoh] Something like this:

+ If (Family) "Letters" Clicked:
> RecordLetterVar.Add: Letters.ObjectName

Imagine Letters contains objects like A, B, C etc. .
It would be tedious to manually write an 'On Click' Event for every letter object separately.[/QUOTE] Yes, it would be tedious. Why not having a family pv and adding that to RecordLetterVar ?

+ MouseKeyboard: On Left Clicked on Blue
-> System: Add Blue('name') to global variable 'letters'
+ System: Always (every tick)
-> output: Set text to global('letters')

'letters' here being a global text var and 'name' a family text var
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu May 31, 2012 2:25 pm

[QUOTE=tulamide] [QUOTE=Shindoh] Something like this:

+ If (Family) "Letters" Clicked:
> RecordLetterVar.Add: Letters.ObjectName

Imagine Letters contains objects like A, B, C etc. .
It would be tedious to manually write an 'On Click' Event for every letter object separately.[/QUOTE] Yes, it would be tedious. Why not having a family pv and adding that to RecordLetterVar ?

+ MouseKeyboard: On Left Clicked on Blue
-> System: Add Blue('name') to global variable 'letters'
+ System: Always (every tick)
-> output: Set text to global('letters')

'letters' here being a global text var and 'name' a family text var[/QUOTE]

Thanks for Your help Tulamide.

Yes, I thought about that too. That seems to be the only way. Then I would however still have to set every variable by hand to the respective objects name.

Don't You think it would be more easy to have access to the object's name? I mean it seems like it would be such a simple thing.
Anyway, it's not that much of a big deal. Just a small annoyance, I guess. lol

By the way, it's nice to see You're still around. Shindoh2012-05-31 14:27:14
B
3
G
1
Posts: 70
Reputation: 615


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests