02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

Changing The Copy Through Code

In this video we find our new textfiled we created in our movieclip, change its copy and store its original copy for future reference.

Video Transcript

00:00Let's see how we would do it first of all. I want to add my property my MC home that I just created
00:05So let me do that quickly
00:09MC home, which is a type of movie clip. We just created a movie clip
00:15Now we're gonna do a little trace here just to see that it works MC home dot
00:19What was the name of our text field? It was called TXT home
00:23Right if I just run this alone, we'll see that we should be getting our text field
00:28But if we want to go even one layer deeper, which we do we could get our text field
00:33Our text value of that text field with the text attribute which return which returns us our home
00:40Which is perfect because that's exactly what we need
00:44The next step is I want to create a new variable which I'm going to create right here which I'm going to call
00:50Home copy which will be a string
00:54Okay, I'm not going to sign in a value in the beginning and then I'm going to set it a value inside of our main
00:59Now again, what does this mean? This means that our home copy is belongs to our main which means it will be available also to other functions
01:07Well, if we would set our
01:09Var inside of our main it would only be available to the function
01:13Main, but we actually want it to be available throughout the class. So we set it as a property
01:21Okay. All right. So next step is we want to actually set the value of home copy as soon as our
01:27Constructor as soon as our application begins
01:30We want to set our home copy to be the value of the text field that was in when the application begun
01:36The next step after that I actually want to go back to that text property and I want to set it to nothing
01:42So I want to set it to an empty string
01:46Thus now I saved a reference to the original copy and then I'm getting rid of it
01:51If we run our application now, we should be getting our home logo again
01:58but without the copy that we
02:00Had inside of it

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!