I'm dynamically loading a file that will indicate when to show certain words at certain frames. However, I'm having trouble with the concept of timeline control from ActionScript (I'm building everything programmatically in Flash Builder). Let's say my tuples has frame and word:
5, "duck"
13, "cow"
22, "pig"
There is a sprite associated with each. What I would like to do is something like the following:
for (frame in timeline) { //should iterate from frame 0-22 (last frame in list)
if (frame in list) {
list[frame].alpha = 0;
}
}
I already know that my display of sprites works and whatnot, I'm just confused on how to play through the timeline in this kind of way, or if it's possible to dynamically do this.
EDIT: Related, can I control how fast the timeline plays?
EDIT: To give a more thorough explanation, I'm looking to visualize word appearances over time in a text. So "duck" may appear as the 5th word in a corpus, "cow" as the 13th word, etc. My list contains tuples of word positions (unique) and the word that appears at that position. I have a small selection of words that I'm interested in from the corpus, so not every position is represented. I would like to be able to have a SWF movies that essentially starts at the beginning of the corpus, go through my word list in order of appearance in the corpus, and then display the word (and have it fade out). So, if there's a word at position 5 and 10, then should appear in much more rapid succession than if there's a word at position 15, and the next one doesn't appear until 50. Basically, I would like to keep that temporal component.
I'm having a little trouble understanding exactly what you're asking about, but in general for controlling the timeline use the commands play() stop() gotoAndPlay() gotoAndStop()
Beyond that I'm gonna need you to explain more clearly what exactly you are trying to do.
ADDITION: From your edits it sounds like you simply want to trigger an animation when the user clicks a button or something. So make the animation in Flash and then use the commands I listed to play it.
ADDITION2: If however you definitely want to do this in code then that has nothing to do with the timeline; program the fading in and out using a tweening library like http://www.greensock.com/tweenlite/
Related
Looking for some help or to be pointed in the right direction. Been stuck on this for a while and the main issue is I don't even know where to start. I am sure there is a solution but my brain will not see it.
To use as an example I have a table that shows monthly results for multiple different areas:
What I want to do is in the gap along side each number is show an increase, decrease or no change, using up arrow down arrow and square. That I can do using conditional formatting my issue comes with the fact that I also want it to be multiple Colours. So it will take into account increase and decrease and whether they are in target.See below:
Atm I am copying and pasting each month. But having it automated would be amazing. The outcome would hopefully look like this:
I am hoping there is a way that I can do two things compare to the previous month and then check it against my table to see where it sits then display the appropriate symbol.
Thank you in advance for any help or a place to start.
So extremely easy to figure out once I looked at it in a simplistic way.
Firstly, I used: =IF(-SIGN(E26-G26)= 0, "n", IF(-SIGN(E26-G26)=1, "é", IF(-SIGN(E26-G26)=-1, "ê","")))
To compare the current number to the previous number and get a 1, 0 or -1 depending on if it had gone up down or stayed the same, using this it either displays é, n or ê. I then set the font on these cells to Wingdings. so they become up arrow, down arrow and a square.
Then I use conditional formatting to colour it based on the adjacent cells value.
No need for a long, complex formula
=IF(A2>A1,"t",IF(A2<A1,"u","v")) - set the font to Marlett
I'm working to improve upon an excellent sheet I found of Debussy's Deuxième Arabesque on the freely available Mutopia Project.
In particular, I'm interested in fitting the music on fewer pages but I struggle to have the first page display five systems instead of four with the version I arrived at.
From the reproduction above, I would like the fith system (starting at bar 13) to be at the bottom of the first page. It seems there are a lot of wasted space on the first page and I'm rather confident it will fit perfectly.
I have a hard time playing figuring out how to achieve this. I have displayed the spacing annotations as advised by the documentation but I do not seem to be able to make sense of it.
If I were typesetting this today, I would try changing the staff size, like this:
#(set-global-staff-size 18)
You can add the following to your paper block
\paper {
min-systems-per-page = #5
system-system-spacing.padding = #2 %fit staves closer together
system-system-spacing.stretchability = #15 %how flexible the spacing is
}
This will of course force that all other pages have at least five systems. You can play around with the padding and stretchability values and see what works best. Also, you might want to make the staves smaller than the default 20pt. To do that, you can add the following at the beginning of the file:
#(set-global-staff-size 18)
I have a symbol of a person standing, he have child movieClips like hands, legs, head, body....so then if i press a button or click in the stage how do i need to change the animation instantly?
I suppose:
1) create a new movieClip that has all the same parts but animated as walking(for example) and then make something like:
if(keypressed)
{
person.replaceSymbol(myNewAnimatedSymbol); //method that not exist
}
2) for example if my standing animation longs from 1 to 30, i can make another animation in the same line let's say from 31 to 60 where he is running and then write:
if(keypressed)
{
person.legs.gotoAndPlay(31); //in the 60 frame he go back to 31 by using gotoAndPlay(31)
person.hands.gotoAndPlay(31);
person.body.gotoAndPlay(31); //and so on...
}
Can you give me an advice of which of methods I need to use? or if you have a better idea how to make it...
Hm-m-m. I'd say your second approach is easier to both draw and control, especially if it'll eventually come to reskinning your MC, say your person will get dressed in a cloak that's attached to the body and arms, your "new animated symbol" will likely require a change to accommodate that clothing, while in case of one symbol you can assign its parts another look, like say person.hands.cover=clothing.handpart; person.legs.cover=clothing.legpart etc, and then the animation will contain references to cover being changed, so that correct parts of clothing will appear around all the moving parts.
In fact, you might not need separating your person into different body, hands, legs etc MCs, but instead make it so that your person's legs are a container that can hold either a bare body part (naked leg drawing) or a dressed body part (a boot, pants, etc), and animate the main part by making these containers move according to how a person should walk, stand, run, attack etc etc., so that you will have a single point to dress the entire set of your person's animations.
It depends for example my character has around 100 animations. Putting them in a single timeline and telling them to go from this label to that label (or frame) is a huge mess to manage.
So I have 100 library items with export symbols. I keep on switching between them. This makes it easy to manage.
So, I think the question is how many animations do you have? Can you manage them in a single timelines? If you can , I'd say go with labels or frame jumps.
Both of your methods are correct and your second method would be faster because you're not adding or removing anything from the display list.
Totally new with Corona and asking for some support.
Would like to create a simple first software with Corona. My idea is to have a button and when you press the button you see different words on the screen. The idea is that they roll randomly and then stops on one word. For example 8 different words and one is chosen and a few seconds and shown on the screen.
For an expert I guess this is imple but for a rookie it´s not that easy.
Use a array of words to store the words
local words = {foo, bar, hi, no, yes, mom, dad}
Then use math.random to select a word.
local wordIwant = math.random(#words) -- # operador gets the length of a list
So if math.random returns 3 for example, wordIwant will be "hi"
:)
Now how you do your special effect and other pretty stuff, is up to you, but I recommend using the enterFrame listener for that.
I am a beginner at ActionScript3, and for my learning purpose, I am trying to build a match3 kind of game. I am making is a clone of bejeweled kind of game. but instead of swapping, I have to delete those elements and shift the upper elements down and add new elements above those shifted elements.
I am able to delete matched elements and after matching I'm removing those elements but I am stuck with the shifting code. I am not able to shift those elements down.
I believe that you should take a look at Richard Lord's Tetris source code as your game may be somehow similar in mechanics to Tetris. Tetris shifts down rows when you get lucky.
Richard Lord is one of the Flash Gurus and his way of doing things may seem pretty advanced for a starter like you. Take a look over the source code and see if it fits you. What I can tell is that this is the proper way to make a game but maybe it's not the best point to start for a novice like you that is in urgent need.
http://www.richardlord.net/blog/actionscript-3-tetris-source-code
I would approach it like this in 2 parts.
Loop through your array of board positions starting from the bottom row and check for an empty unoccupied slot, if you find one do another loop through the row above till you find a piece on the same column. If you find a piece on the row above apply a tween to move it down to the empty slot and continue your loop.
Once you have looped through all rows, and animated all the tweens you need to loop through again to find all the gaps that need gems dropped into them. Create new elements at those positions and then move them up by (element height * row), apply another tween to animate them back to their starting position.