ActionScript 2.0 :: Auto Detect Most Used Color From Dynamic JPG
Feb 9, 2009
Is it a easy way to detect most used color from one jpg? I worked out a way to do this, however it seems like Flash cant handle large "for-loop" and it lead to calling abandon script during test movie...
I tired this:
1) Dynamic load in a image
2) Use Bitmapdata to register all pixel data into a array (call it A)
3) Convert A into Array B which contain no duplication of value
4) Run through Array A and adding count to see which color appear more than once or so, record it all to an Array C
5) Find out the Maximum number from Array C to determine which is the common used color from the image.
All the above did actually work in the code. My problem is, damn flash seems to handle well with image like 10*10 pixels (100 steps I suppose), swap it with 50*50 will call murder! Anyone come across issue with large "for-loop" and what is the best way to get around this?
View 0 Replies
Similar Posts:
Jun 23, 2010
I have a custom component Comp that gets its position changed as a result of interactions with other components, etc. I check for changes in its position by constantly checking its position at fixed intervals. I'm looking for a better solution (maybe an event-based solution) to monitor its position so I don't have to check constantly myself.
[Code]...
View 3 Replies
Jun 6, 2003
There is a way to detect the browser version in the html file?I wanna do something like this:
if language == us
load us.swf
else if language == jp
load jp.swf
View 3 Replies
Aug 18, 2010
I'd like to provide alternate content for my site (a basic blog for example) in case the user does not have flash/does not want to see the flash site. Is this possible? I'd like to do it without creating a splash page that requires input.I would also like this to work for a mobile device like the ipad. I know ipads/iphones cant read flash files, so is there a way to detect that it is a mobile device and route the user to the alternate content?
View 1 Replies
Jul 1, 2010
Is is possible to detect within JavaScript of Flash if there is auto audio another flash object (mostly ad) on the page?
View 2 Replies
Nov 26, 2008
I'd like to use the same code base for both desktop AIR and browser plugin applications, with some changes in the manner in which data is loaded and saved. Ideally, I would like to auto-detect the current environment so I know where to look for the data to be loaded, either from the filesystem or from a URL. Is there a simple test that can accomplish this without relying on a hack?
View 2 Replies
Oct 18, 2003
How would I make a dynamic text boxes border a certain color, along with background color.
View 1 Replies
Jul 28, 2009
I have a movie clip where it contains an instance of text
I able to change the movie clip and text color individually
but when i try to change both at once the text color is same as movie clip color
ActionScript Code:
myColor = new Color(myMovieClip);
myTextColor= new Color(myMovieClip.myText);
[Code].....
View 3 Replies
Apr 21, 2005
How is it done? All I've seen on the web is how to change the color. Well how about going back. I'm talking about a MC with many colors. I can't just change back to a single hexadecimal color.
I can accomplish the change as it passes over a frame, but I can't get it to change back.
In the frame is this:
Code:
cHurtColor = new Color(_root.compMC);
cHurtColor.setRGB(0x00FF33);
View 6 Replies
Apr 21, 2005
All I've seen on the web is how to change the color. Well how about going back. I'm talking about a MC with many colors. I can't just change back to a single hexadecimal color.I can accomplish the change as it passes over a frame, but I can't get it to change back.[code]
View 6 Replies
Aug 9, 2009
Currently making a music project that will, in theory, play sounds based on detected colors a webcam can see.
I'm certain this is possible in either AS 2 or 3 - but unsure exactly how.
I've searched the wonderful nets for a tutorial or an example of this being done with flash but have come up with nothing.
Is there any tutorials for detecting colors and then responding to them? (All as viewed by webcam, so in real-time).
View 5 Replies
Aug 16, 2009
I need help with a small flash project i'm doing. Basically the task is to detect a color via webcam, then respond to what colors it can see (using the webcam). Example Color red is held in front of camera - flash sees this, then respond by playing a sound. green and red is held in front of cam, flash can tell there is two colors, plays a sound. etc would writing the webcam video object to a BMD every frame, then getPixel that to work out the colors? I'm guessing i'd need to use colorTransform to merge all the blues, reds, greens, etc together (so it only checks for those 3) then responds if it finds them with getpixel?
is there any examples of that, or something similar i could work from? would anyone be able to give a quick write up of what this might looklike/how to do it? (havent done much programming in as3) All i need it to do is: Check video for range of colours (ie, blue, light blue, dark blue, etc, all are equal to blue, unsure how i'd do this. Was thinking Yellow, Red, Green, Blue as the 4 colours) If any of those are in the video, then respond by playing a sound. (However if yellow and blue are in the video at the same time, play a DIFFERENT tune)
View 1 Replies
Jul 11, 2009
Can I detect the color of a pixel or an area in a Display Object?
View 2 Replies
Apr 5, 2010
How can I auto scroll dynamic text (text picked up from xml file) vertically.
View 1 Replies
Mar 19, 2010
I have a dynamic text box that I'm loading data into from a PHP file using loadVariablesNum("data.php", 0);
The PHP runs a SQL query that fetches data from MySQL. The data in the MySQL database changes frequently, and I want to update the dynamic text box with the latest info.
How do you do that? Or is it possible? I assume you use setInterval.
Currently, it only updates the field if I visit the PHP file and refresh the data. Otherwise, the dynamic text box just displays the data from the last SQL query.
View 7 Replies
Aug 31, 2011
I am writing a script which will load a csv file and Auto/Dynamic insert buttons depending on the number of lines within the csv & the X and Y position. Eventfully the user will be able to move they mouse over the buttons and a pop up will appear with information contained within the csv file. I have managed to generate the buttons and event handler to mouse functions, which is triggered from the mouse click, up etc. My question is how to work out which button the mouse is over? If they is ten buttons generated, how do I detect which button has been pressed to display the appropriate information in the pop-up?
[Code]...
View 1 Replies
Jan 10, 2012
I have a dynamic text box called logtxt. I add text to this whenever i click on my box object.(this works fine) I have a UIScrollBar attached to the text box(still works). But I need it to automatically scroll to the bottom whenever I add text.
View 1 Replies
Jun 28, 2004
I am trying to make a photo gallery that is dynamic instead of throwing the pictures in a movie and tweening effect inbetween them. I know, why take the easy route.
What basically I want to happen is that when the movie loads the first image is displayed for 4 seconds then fades out as the next image is fading in. I have 11 pictures that are in a folder called "weddings". The pictures are all named "weddings0.jpg", "weddings1.jpg", "weddings2.jpg",...... "weddings10.jpg". Here is the code for this part, I have tested and it works:
Code:
totalImages = 11;
k=0;
var aWedding = new Array;
[Code].....
View 3 Replies
Oct 4, 2005
out with autoresizing dynamic img popups with javascript.
View 14 Replies
Feb 16, 2007
I'm having a problem with adjusting the size of a dynamic textbox to display text imported from an external XML file. I've tried using .autoSize = true, but it doesn't work.
View 3 Replies
Mar 9, 2011
I have a series of dynamically created text fields that form a grid and I want people to be able to auto tab through each field in the grid. I want them to be able to enter in 1 character and then have the focus move to the next field in the grid.All of the TextFields are named "inputBox" with an ID number added to the end using the name property of the TextField class. So they are named as follows inputBox0, inputBox1, inputBox2, etc.Now for the code I am using to change focus to the next textfield:
stage.addEventListener(KeyBoardEvent.KEY_UP, checkTextField);
function checkTextField(e:KeyboardEvent):void{
var instanceName = e.target.name;
[code]....
View 1 Replies
Jun 28, 2004
I am trying to make a photo gallery that is dynamic instead of throwing the pictures in a movie and tweening effect in between them. I know, why take the easy route. I have something really wierd going on, maybe you can help. What basically I want to happen is that when the movie loads the first image is displayed for 4 seconds then fades out as the next image is fading in. I have 11 pictures that are in a folder called "weddings". The pictures are all named "weddings0.jpg", "weddings1.jpg", "weddings2.jpg",...... "weddings10.jpg".
Here is the code for this part, I have tested and it works:
totalImages = 11;
k=0;
var aWedding = new Array;
//The for statement creates new movieClips with the images loaded and stored within
//stores the movieclips in an array.
[Code] .....
At this point I have loaded all the images into movieclips and stored their references in an array. I have also gotten them all alpha of 0 except the first image, weddings0, which I want to display first. My function to make the images scroll through doesn't work. If I trace what the alpha is as it scrolls though I get wierd numbers like 93.3233432 or 32.323223 which doesn't make sense to me because I am increasing or decreasing the alpha by += 2 or -= 2. I don't know where the functions come. Anyway, here is the code, or what I have I should say, btw
I have the code linked to a button right now to test if it works, I would like it to run automatically on load:
Code:
butt.onRelease = function(){
trace(k + " k");
tempInt = setInterval(fadeInOut, 10, aWedding[k], aWedding[k+1]);
} function fadeInOut(mcPic1, mcPic2){
[Code] .....
View 3 Replies
Apr 18, 2009
I created a flash that's loading dynamic text from an external txt file. It's ON AIR flash that you can see on top right on [URL]
Now the thing is that I WANT THIS TXT CONTENT TO REFRESH AUTOMATICALLY... because I am actually loading txt file that's getting updated every few minutes, but flash content does not update, so the visitor must refresh page on go to some other page so the content will change again.
How do I make this work so that dynamic text in flash change whenever external txt file content change, without refreshing or changing the page.
View 1 Replies
Apr 18, 2009
I created a flash that's loading dynamic text from an external txt file. It's ON AIR flash that you can see on top right on www.topfm.rs Now the thing is that I WANT THIS TXT CONTENT TO REFRESH AUTOMATICALLY... because I am actually loading txt file that's getting updated every few minutes, but flash content does not update, so the visitor must refresh page on go to some other page so the content will change again. How do I make this work so that dynamic text in flash change whenever external txt file content change, without refreshing or changing the page. [URL]
View 1 Replies
Mar 29, 2010
I've struck with this issue for a long time now.I have one dynamic textbox that'll read a text file written in Thai language.The text shows fine, but when it have to go to new lines it'll go likeFor word: "Thai Language"Desired result:Thai LanguageMy program:Thai LanguageIs there a way to make dynamic textbox do an auto format with Thai/any language that will prevent this behavior?
View 1 Replies
Oct 21, 2010
I have dynamic text field that must be a fixed width and height. The actual text that will populate the dynamic text field is variable. What I would like to do is to reduce the font size if the text does not completely display within the text field's dimensions. How I can accurately perform this? Also, I am using AS 2.
View 2 Replies
Jun 22, 2011
I have dynamic text field that must be a fixed width and height. The actual text that will populate the dynamic text field is a variable. What I would like to do is to reduce the font size if the text does not completely display within the text field's dimensions.
View 2 Replies
Aug 11, 2010
I'm trying to have a dynamic text field with a black background. I want the text to be of fixed width, but expandable height, and for the background to grow with the text field depending on the input. I looked at the "autoSize" property for TextField, but it looks like that only adjusts the width.
Some "pseudocode" for your consideration:
rolloverInfoBox.infoTextTitle.text="Title";
rolloverInfoBox.infoTextBody.text="Text body...";
rolloverInfoBox.infoTextBody.autoSize=true; // doesn't work; just for reference
rolloverInfoBox.expandableBackground.height=rollov erInfoBox.infoTextBody.height;
View 6 Replies
Sep 28, 2007
I Have a question regarding a dynamic XML driven image slide show.
I want the movie to slide continuessly from the left side automatically when it is loaded. Now it only loads when a mouse movement enters the screen.
The link is: [URL]
Here is the code from the main time line, Frame 2 (Frame 1 loads the XML file:
stop();
// Number of items
itemNum = 15;
// Stage Dimentions
[Code]....
View 2 Replies
Apr 18, 2009
I created a flash that's loading dynamic text from an external txt file. It's ON AIR flash that you can see on top right on [URL]. Now the thing is that I want this text content to refresh automatically... because I am actually loading txt file that's getting updated every few minutes, but flash content does not update, so the visitor must refresh page on go to some other page so the content will change again. How do I make this work so that dynamic text in flash change whenever external txt file content change, without refreshing or changing the page. I am attaching .fla file.
View 1 Replies