Accessing a variable in nested movie clips - Actionscript 2 - actionscript-2

I would like to access a variable(txt1) set on an input box.
The input box is in a movie clip called txt_0143. am trying to
access it in the parent movie clip called part_0.010 . So the
hierarchy goes as root->part_0.010->txt_0143->txt1.
I have used the following function on another sibling clip in part_0.010:
on (release) {
getURL("http://www.google.com/?q=" + txt1, "_blank");
}
When I just use the txt1 in the script from part_0.010, i get
_level0.instance28.rm.txt1 in the place where the text should be.
Else i tried _root.txt_0143.txt1, gives me undefined.

To get the text of a TextField, you need to use the text property.
So when you output the txt1 it just gives your the path to that object. So it seems that you have the right object if it returns "_level0.instance28.rm.txt1" instead of the actual text.
So your code should look like this instead:
on (release) {
getURL("http://www.google.com/?q=" + txt1.text, "_blank");
}

Related

How can i show the image name when i taking a picture?

Im trying to show the name of the image i take with my Camera but i dont know how.
Do i need a another function to show the image name?
My Code for taking picture:
Public Function takePicture() As String
Dim url = THETA_URL & "commands/execute"
Dim payload = New Dictionary(Of Object, Object) From {
{"name", "camera.takePicture"}
}
Dim request As Net.WebRequest = Net.WebRequest.Create(url)
request.Credentials = New Net.NetworkCredential(THETA_ID, THETA_PASSWORD)
Dim resp As Net.WebResponse = request.GetResponse()
End Function
See the line where is says:
End Function
Look in the line numbers margin; next to it there is a blank bar (mine is dark gray in my theme) - click in it to put a red dot:
End Function will go red too..
Then run your code and retrieve your image. The code will stop with a yellow bar pointing to End Function
Take a look at the bottom of VS - you'll either have an Autos window or a Locals window - either one will do. It will show the response object and you can drill into it like a tree, open the headers collection, have a look if anything in it contains the data you want.. It also thus tells you how to get the data you want out of it..
e.g. if I wanted the "Content-Disposition" value I could say resp.Headers("Content-Disposition") - AllKeys is showing me what available strings I can use to index the headers collection
Content-Disposition probably won't list a filename on its own - it'll be something more involved like "attachment; filename=someimage.jpg" so you'll need to pull the data you want out of it. Don't get your hopes up if this is a basic cam; it's unlikely to have any meaningful sort of filename. It might be IMG_0001 etc, if it's there at all - I think you should instead make your own name up, as you'll be able to put more info into it, it will be more meaningful than what you get from the cam (and if the cam doesn't send a filename you'll have to do it anyway)

How do you add a picture to the ID3 Album tag using taglib#

I've been searching the internet and trying various methods to save a picturbox image to the the id3 Album picture tag. One sample code says the Album cover tag name is taglib.ipicture another says taglibVariable.Image and yet another says taglibVariable.picture(0).
I am becoming so confused I'm starting to repeat sample test code.
Where is the documentation that will explain what I have to do.?
What little information I can find are dead links to sample code or incomplete code using variables without explanations. When I look up the commands and try to format or convert to the needed data type, I get an error. Usually system.image.bmp cannot be converted to iPicture.
Can anyone give me some working code or a pointer on how to word the proper search term to add a picturebox.image to the Album picture tag. Saving the image as a file then opening as image to put in tag then deleting file is not an option. I need to create a memory image and add that to the picture tag.
This is what I use:
public void SavePicture(string fileName, string picName) {
try {
IPicture[] pics = new TagLib.IPicture[1];
pics[0] = new TagLib.Picture(picName);
using (var songTag = TagLib.File.Create(fileName)) {
songTag.Tag.Pictures = pics;
songTag.Save();
}
}
catch {
// process
// mpeg header is corrupt
}
}
fileName is the full path to the audio file;
picName is the full path to the picture.
You can add multiple pics by setting the array size for the IPicture array accordingly...

Dynamic Element created inside a div must be clicked

I need get the id of my dynamic created element inside a div.
I'm looking for a way to get it's id by clicking it.
Example:
$("#div").on("click", '*', function () {
alert($(this).id);
});
The element can be an image, link, button, etc...
I need to dynamic bind click to it, and get the id when gets clicked.
I use append to add sub elements to div.
$("#div").append(element);
Elements are right shown, but i can't retrive the ids.
Is there anyway to get it?
Example in jsfiddle:
http://jsfiddle.net/StTvn
http://jsfiddle.net/StTvn/2/
changed the listener selector and it works
$("#myDiv").on("click", "*", function () {
txt = $(this).attr('id');
alert(txt);
});
as a side note, id that start with a number are not valid html - you might want to change the way you generate them like this:
el.id= "img" + i.toString();

Initialize the textfields in Sencha touch 2

I have a sencha touch form, which has two textfields. I want to assign some text to them on page load. I tried setting values in init and launch functions. But in those function textfield are not available, they are undefined. So which event should be used for this purpose?
Either set the values with the setRecord({textFieldName1: "value", textFieldName2: "value"}) method of the container, or assign an id to the text fields and access them via Ext.getCmp('textFieldName').setValue("value") in the initializemethod of the container.
Can't you use the value property directly ? Setting the value will make the textfield fill with the corresponding value of value property i.e in our case, "Sample Text 1" etc ..
e.g
{
xtype:'textfield,
value:'Sample Text 1 ',
},
{
xtype:'textfield,
value:'Sample Text 2 ',
}

How can I group functions together

I have created an image map with flash, I have separate button functions that display rollover and onpress functions for each region ie -
nw_btn.onRollOver = function() {
areaName_txt.text = "This Site (NWPHO)";
}
nw_btn.onPress = function() {
displayOverlay(areaName_txt.text);
}
This is repeated 15 times to cover each area button - I wondered whether there was a way to apply the same function call (displayOverlay) and apply area name text on rollover via one piece of code rather than repeating for each button?
I guess there must be a mistake with your tag, because what you describe look more like an AS2 structure.
But if you really are in AS3, here is what you can do : connect everything to a same function with addEventListener. In this function, test which button is at the source of the event, then put the code to be executed for each button.