ActionScript 3.0 :: Textfield Holding PlayheadTime?
Feb 1, 2010
I've created a textfield which I want to hold the time that is left of a flv being played. I also created a timer which will see to it that it gets updated.
Here is the code:
"import flash.utils.Timer;
import flash.events.TimerEvent;
var myTimer:Timer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER,updateCo untdown);
[Code]...
However, when i try to compile i get this error message: "1067: Implicit coercion of a value of type Number to an unrelated type String.
View 1 Replies
Similar Posts:
Nov 8, 2010
I'm building a custom Audio Player. The whole thing drives a MediaPlayback component. I have a scrubber set up that moves with the progress of the song. I want to be able to click and scrub with it though. Currently I have it set to set the playheadTime equal to the percent distance the slider is dragged to times the totalTime of the playback component. After the release of the slider I trace out the playheadTime and it seems to be fine, but I can't get it to resume playing at all. Here's the code in the controller:
var totalDistance = bar_mc._width - slider_mc._width;
var wasPlaying = false;
this.onEnterFrame = function(){
[Code]....
View 1 Replies
Mar 3, 2011
I use flvplayback to play a 20 seconds flv video, but I can't get accurate playheadTime no matter how to set the attributes.
Here is my as3 codes.
import mx.video.*;my_FLVPlybk.playheadUpdateInterval=10;//my_FLVPlybk.seekBarInterval=100;//FLVPlayback.seekBarScrubTolerance=100;function the_play(eventObject:Object){ ta.text = my_FLVPlybk.playheadTime; // ta is a textarea.}function the_end(eventObject:Object){ ta.text = "video over";}my_FLVPlybk.addEventListener("playheadUpdate", the_play);my_FLVPlybk.addEventListener("complete", the_end);
I drag seekbar to between 0 and 8 seconds, it always obliges to 8.333 .
View 1 Replies
Mar 16, 2012
I am currently on a project (AS3), where I have 2 frames, with videos (using the FLVPlayback component). and I want to switch from one video to the next video, however the catch is when i switch to the next video I want the new video to play at the previous video time. example: Video 1 plays, 10 sec later, you click a button to go and see the next video (in another frame) and that new Video starts 10 sec into it.
[Code]...
View 15 Replies
Oct 17, 2006
In the code below when the user presses the button it set the video back to the start I just need it to go back on second
//Rewind
Rewindbtn.onPress = function (){
biz_need.playheadTime = 0;
}
Next question how would I display the biz_need.playheadTime and biz_need.totalTime in my flash app?
View 1 Replies
Mar 28, 2011
scripting for holding a button down and having the action take place once.So thing is, I have code for pressing a button (which is the up arrow button)This was suppose to show the animation for someone shooting constantly until released:
if (Key.isDown(Key.UP)){ fox.gotoAndPlay(16); deploy.gotoAndPlay(2); trace("Pressed."); }
Unfortunetly the results are:Holding down the up key places out "Pressed." constantly instead of once.fox.gotoAndPlay(16) stays on 16 rather progressing the animation (to which should come back to 16 at a repeated process)deploy.gotoAndPlay(2) plays a sound but before: the sound played constanlty rather once) recently: sound never playsI also need code that prevents the player from moving when holding down the up arrow key.So in total, I want the player to be able to hold the up key, and everything executed is played once until pressed agan after release.I heard about adding listeners:
var myListener:Object = new Object(); myListener.onKeyDown = function() { KEY = Key.getCode(); if (!this[KEY]) { trace("You pressed "+KEY); } this[KEY] = true; }; myListener.onKeyUp = function() { KEY = Key.getCode(); trace("You released a key."+KEY); this[KEY] = false; }; Key.addListener(myListener);
but I can't understand this technobabble and everytime I try to work it, it only puts error outputs.
View 7 Replies
Jun 23, 2009
I am getting the session generated in Flex Application in a hidden text field, but when i refresh the page it gets back me to login page...
How can i hold the session of the page until the browser is not closed...
I am getting the session value from PHP.
View 2 Replies
Jan 15, 2010
How can I differentiate between these two actions in AS3? I'm working on a side-scroller,and I want to require the "attack" button to be pressed for each successive attackCurrently you can continuously attack by holding down the attack key. I'm using a standard event listener, i.e.
ActionScript Code:
private function keyDownFunc(event:KeyboardEvent)
{
[code]....
View 1 Replies
May 22, 2010
I have a mc which is a square. I want to make a grid with it. Everybody knows how a grid looks like. Heres the main issue: I want to have a full control over each single element of the grid. I want to put them all in a 2d array, so I can access them by giving a row and a column number, e.g, so as to remove a specific mc, Id write: container.removeChild[_myArray[i][j], where i and j stand for the row and the column.This is how my current method for creating the grid look like:
ActionScript Code:
private function drawGrid():void
{
var startX:uint = 0;
[code]...
It does draw a grid, but I dont have a power over it. And even if I do, I cant see any way of accessing a specific box.
View 3 Replies
Apr 9, 2009
I have separated the background info on the "WHY", from the "WHAT" so that people can give me feedback on my question directly, but if they require more information, they can read my background info to understand the purpose of what I am doing.
======================================================
Background Info (the WHY):
======================================================
I am working with an actionscript structure as follows:On a specific frame exists a controlling function or "node". It contains a user defined array of "branches" or sub functions. These sub functions(branches) are of a user-defined class which can hold other code. Other programmers will be using this structure. When they work with it, they will be dynamiclly adding new "Branches" which the node will then run in whatever way they specify. I am coding the node, and creating the different execution options that the other programmers will be able to use.
One of these types of executions is for the node to LOOP through the branches (however many there may be) waiting for either a key press or a mouse click. On either input it should exit the node and continue on to the rest of the frame, and then the rest of the program.
My original structure is based on user defined Event Listeners and Dispatchers. Upon Entering the node I begin by defining:
addEventListener("BranchComplete",nextBranch); addEventListener("RepeatDone",runComplete);
runComplete executes when the node has finished, nextBranch is fired after each branch has successfully finished.
I originally fired off:
dispatchEvent(new Event("BranchComplete"));
as the last line of the Branch executing function. The problem with this was, the function "nextBranch" does not return until all that it has called/triggered has finished. "nextBranch" ends up being called recursively by the EventListener. This causes a stack overflow.
I then changed the code, by moving the 'dispatchEvent' command into the same function that added the EventListeners. This ensures the function "nextBranch" has finished and returned before the EventListener triggers it again. This prevents the recursion and the stack overflow, but creates a new problem: The 'DispatchEvent' only occurs once, as after the second time through the branch, it returns and continues on the line after the dispatch.
In order to get around this, i placed the dispatchEvent inside a do...While loop, that tracks a variable that is only set to false when the user gives Mouse or Keyboard input. Voila, problem solved, code loops forever while calling "nextBranch" and triggering "BranchComplete" events as they complete. The only problem is, user input doesnt seem to be caught, due to the infinitely repeating while loop.
To test that it does in fact work correctly, i set the While Condition to automatically turn false after 1000 iterations. This works perfectly, and exits after 1000 branches have executed, all triggered by the Dispatched events. So, I want it to loop through my Branches until Key press or Mouse click. It appears that during a while loop, Keyboard and Mouse Listeners will not trigger. Is this true, and what is the best solution for holding in a loop while waiting for an event listener to trigger?
View 5 Replies
Jul 31, 2011
I want to create flex/actionscript directory view for my files with php/mysql. I have some ideas that I want to share:
1)I am thinking of creating table (in mysql) "files" and another table "folders", when user loges in i will require all data from "files" and "folders" where Username = 'something'. But the problem is, I will create a lot of entries inside of tables. For example if I will have 100 users, and each user could create 100 entries (files or folders) it means that i will get 10000 entries inside table.
2)My second idea, and I think more safe way of doing it is creating table "users" where will be set id, username, password, ... , files, folders. In files (text format entry) will be listed information about files, and they will be dividend by "*" symbol like this:
id*file name*size(in kbytes)*path*status
example:
15*test.exe*150*/root/*private
16*test2.exe*200*/root/folder1/*public
[Code]....
Now here is only 3 file info but there can be more than 1000.
View 2 Replies
Nov 3, 2009
Having a bunch of dynamically-created MC's, what is the best way to store custom variables for each MC?Do I just make a hidden textfield inside each MC to hold the data?For example I have MC's called:-Apple1-Apple2-Apple3-etc...And inside each MC I have a variable appleEaten = X.And eventually I could use the data in an IF statement like:
View 4 Replies
Jan 24, 2006
I'm working on a project where I have Multiple instances with the same actions.
Instead of typing out
btn1._visible = false;
btn2._visible = false;
btn3._visible = false;
btn4._visible = false;
Could I store these instances in an array so that I could minimize my code to something like:
btnArray._visible = false;
I've tried to do this but it seems to read the instances as strings instead.
View 11 Replies
Apr 26, 2006
I'm working on a ACAD flash system, and one of the functions is to draw lines. Now I'd like to be able to draw vertical/horizontal lines by holding a key down (i.e. Shift). But I'm finding that the system is detecting me releasing the mouse (I'm not) while I hold another key.
Attached is a .fla file where you can click and drag a box.
Don't worry about posting "oh you should use startDrag()" and whatnot. The architecture of the actual application makes such things not feasible. This is just a test .fla.
The code is here:
ActionScript Code:
on (press) {
this.onMouseMove = function() {
trace('Mouse is moving');
[Code]....
So yeah, as you run it and drag the object around, you see a lot of "Mouse is moving", but if you press and hold any key, you'll also notice the "Mouse released" as well.
View 3 Replies
Jun 22, 2010
Having a bunch of dynamically-created MC's, what is the best way to store custom variables for each MC? Do I just make a hidden textfield inside each MC to hold the data? For example I have MC's called:
[Code]...
And inside each MC I have a variable appleEaten = X. And eventually I could use the data in an IF statement like: if appleY.appleEaten == X then do something. What is the best method, or generally common way of doing this? Maybe I'm already doing it,
View 2 Replies
Oct 19, 2010
I need to have the user click on a button, and until another button is clicked, keep that button on the "Down" state.
View 2 Replies
Oct 5, 2008
Working on an important piece at present; I need to make theimage wihtin a holder_mc go fullScreen, not the whole interface.Heres my code thus far:
masker.addEventListener(MouseEvent.CLICK, fullScreen);
function fullScreen(MouseEvent):void
{
[code].....
View 8 Replies
Aug 13, 2009
ActionScript Code:
_root.UpnDown_mc.up_btn.onPress = function () {
_root.Website_mc._y += 30;
[code]....
very simple code, you press the down button on the screen and the page moves down, and similarly for the up button, by 30 pixels...but it only happens once? I need it to continue for as long as the button is being held down.I have tried placing it within the onEnterFrame event, but it still only occurs once.
View 1 Replies
Nov 20, 2005
right now, my code looks like this:
Code:
onClipEvent(load){
speedy = 1.1;
gravity = 9.82;
[Code].....
What I want is that the flash should wait until I've finished pressing space, and the longer I hold in space, the bigger the variable speedx is. I can hold it in right now, but the ball will fall before I've released space. I'm really new to this so please be nice
EDIT: the flash is a ball that "throws", and the code is on the ball, which is a movie clip.
View 2 Replies
Sep 8, 2011
Is it possible to put a function into an array and execute it from calling it via the array?I did this before in as2 [code]
View 2 Replies
Dec 10, 2009
My flash piece is not responding when I mouse over it, unless I hold down the mouse button while I do it. It's as if the flash object is actively surrendering focus unless I hold down the mouse button or something.
View 1 Replies
Mar 12, 2007
Basically I wanna remove my mc "ball" when you press the left arrow key. I've tried stuff like
Code:
if (Key.isDown(Key.LEFT)){
ball._x -= 1;
}
Some reason gives me like, "needs clip events"
View 6 Replies
Aug 13, 2009
I'm trying to make a slideshow holding 3 images with 3 different categories. The images is loaded through an XML-file.
My xml looks like this: (the number after IMAGE[] indicates the category)
Code:
<?xml version="1.0" encoding="utf-8"?>
<SLIDESHOW SPEED="2">
<IMAGE1 URL="images/1.jpg"/>
<IMAGE1 URL="images/2.jpg"/>
[Code]....
View 8 Replies
Aug 1, 2007
I have created a flash file using XML to populate a dynamic text field. I have a UIScrollBar componant added to my text box to scroll through the XML. The movie works fine both when testing the movie in flash and when I access the file that is stored locally through IE. As soon as I upload the file to my server, however, the scrolling functionailty no longer works. The XML is visible on the site and it is possible to scroll using the mouse wheel; the bar itself, however, appears to be disabled for some reason.
View 9 Replies
Nov 12, 2009
when I'm running and not holding my keys down then the friction should slow me down. That works but the speed never stops at zero. I can't see him moving but I've put a text that draws his speed, because if the speed isn't zero and I'm not pressing any button then he will slide and that doesn't work look here: [URL]
The code in the player I use is:
[Code]....
View 1 Replies
Dec 28, 2010
I am making my first game and it's my first time using actionscript. I am making a sniper game themed with the L96A1 sniper rifle from COD: Black Ops and the map nuketown. I'm in cs5 with ac3 and on my stage I have two movie clips that I'm working with. I'm not really sure if they're supposed to be movie clips though. Anyways, one is the gun, and the other is the zoomed in scope overlay thingy.
For now, I'm trying get the zooming in to work. I haven't done anything else though except collect graphics for enemies, the landscape, the gun, and the scope. I want to make it so that you zoom in and out by holding and letting go of the space bar. Also,I want to make it so that when you are not zoomed in, the gun moves horizontally at the bottom of the screen (aligned vertically with the cursor). And when you are zoomed in, the scope crosshair is the cursor.So my idea was to set the gun as the cursor and make it only move horizontally at the bottom of the stage and then make an event listener that listens to when the spacebar is pressed and when it is, disables the gun as the cursor (and makes it transparent to get it off the screen) and makes the scope the cursor [was transparent, now opaque and unrestricted(vertical movement also)].
I got as far as making the gun move horizontally at the bottom with the cursor. I cant get the event listener working because I don't really know how to go about changing the opacity of each movie clip and how to switch cursors. So I am asking how do I change the opacity and switch the cursors when the spacebar is held and then reverse those changes when the spacebar is released? Here's my code on an "actions" layer [I haven't done any animations yet, so everything is on frame 1. Also, I used a couple preset code snippets since I have no previous experience with actionscript (I can understand most of it though)]:
Code:
import flash.events.KeyboardEvent;
// make gun cursor
stage.addChild(gun);[code]..........
Here's a link to a zip archive with all the files used so far (I hope this google docs link works): link
View 2 Replies
Feb 2, 2010
is there any way to increment a display number up or down my clicking / holding a button?
im making a project to select a fuel tank capacity and want the default to be 0.0 gallons and have the user increase the number or decrease the number by clicking and up or down arrow button... If they hold the same button that function would ideally increment faster, perhaps by multiples of ten until it reached a max / min number.
View 16 Replies
Jan 20, 2003
I am trying to make a couple of Movieclips hide on the holding down of a key such as Page down ive used this:
[Code]...
it hides the MC but doesnt return visible on release of PGDN. Ive had a go at trying to fix this but i cant find the right command in the actionscript dictionary. Also is it possible for the MC to hide only on the holding down of multiple keys.
View 2 Replies
Jun 7, 2009
Recently I've been developing in a certain way that i'm not sure is wise, so I thought I would ask the guru's here for guidance. Let's say I'm developing a game with an "Enemy" class. Recently I've been making references to all the subclips in the Enemy animation and holding them in my class as variables, so for an Enemy called "Troll" i might have variables in the class saved as:
private var _walkAnimation:MovieClip;
private var _runAnimation:MovieClip;
private var _attackAnimation:MovieClip;
and then reference these whenever I need to flip between the animation states for that Enemy instead of using getChildAt() or getChildByName() to find the relevant subclip every time I wanted to reference it. I was once told saving CPU was more important than conserving memory in cases such as this, but I wanted to make sure this was true. Your thoughts?
(I call a dispose() or destroy() function when I remove enemies so the references can be Garbage Collected)
View 2 Replies
Mar 19, 2011
I replace div holding flashplayer with blank and my swf movie/buttons disappear. All good. However, when I right click the mouse over the area, the flashplayer is indicated as still being there. How is this possible if the contents of the div is replaced with " "? The flashplayer, not recognizing Z-index interferew with drop down menues.
View 5 Replies